473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how To Create Auto Generated Unique Identity Code in a SQL Table

how To Create Auto Generated Unique Identity Code in a SQL Table , when i Insert Data into TAble
Jun 23 '07 #1
1 2156
Purple
404 Expert 256MB
Hi vinay22 and welcome to TSDN !

take a look at the following:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE [dbo].[auto_inc_example] (
  2.     [field1] [int] IDENTITY (1001, 1) NOT NULL ,
  3.     [field2] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  4.     [field3] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
  5. ) ON [PRIMARY]
  6. GO
notice field1, defined as an int, Identity keyword first parameter the startpoint for the identity value, second for the increment value for each record.

Hope this helps

Purple
Jun 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: flkeyman | last post by:
Work in legal office. Trying to create solid designed database structure. This is list of tables w/fields and primary keys. Any comments/advice greatly appreciated. tbl-Defendants CaseNumber...
15
by: Mr Newbie | last post by:
Hi Guys, Im writing an application presently and I need to create new SQL Records. The problem is I want to know the last record ID number which I inserted. The way I have it set up presently...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
2
by: miladhatam | last post by:
hi i know how can i create a table with sql command but i don't know how create a field with type integer ,autoNumber (auto increase) and Primary key Like id field in Access may you change...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
8
by: Ornette | last post by:
Hello, I have a stored procedure which generates some values in the table. When I use update() how to populate the dataset with theses values ? For the moment I use output parameter but it...
0
by: Frank Swarbrick | last post by:
>>On 6/10/2008 at 4:30 PM, in message <ebf88f96-d8b0-4dfc-85ed-a3a5c44ae4dd@i18g2000prn.googlegroups.com>, <anuritab@gmail.comwrote: Seems like that would work, unless you are actually using a...
2
by: Zunil | last post by:
Hi All, We are testing one of our component with JDBC + DB2 using db2jcc driver. We afced a strange issue. Scenario is like this. 1. We insert 1 record to a table having IDENTITY column as the...
6
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.