hello frinnds, i am new to this forum.........afte seeing this i feel it is gonna helpme.....

right now my problem is->

i am usin msql, here i am using a table in a database..inside this table i have field called ID, i want autoincrement feature for this field......... i don have much knowledge in mssql, hope u people help me.......:confused:

Recommended Answers

All 2 Replies

If you create the table in Enterprise Manager or Visual Studio there is a list of properties for esach column you create, three of them are called identity (yes,no) identity seed (what number to start from) and increment (the step, or how much to increment by when creating each new record)

These properties are unavaliable unless you set the columns data type to a numeric one like int or decimal.

Search the Books Online manual that comes with MS SQL for IDENTITY it will tell you all about it.

If you script you're tables (which is a good thing to learn) the following is the TSQL for declaring a column to be an identity column.

create table mytable
(
       [ID] IDENTITY(1,1) Primary Key
)

the first argument 1 in the parentheses is the seed and the second 1 is the step

thanks buddy.......
hope we continue the same in future

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.