How to create Identity Column in a table

  • Can any one please let me know the query for how to create a column in a table with

    Identity = True

    Identity seed = 1

    Identity increment = 1 and the new column should be primary key..

    Thanks in advance,

    Vamshi.

  • Check Books On Line for the same, Even u will get some more important things about Identity Columns...

  • simple example

    create table tablename (

    ObjectID int identity(1,1) not null constraint PK_Tablename primary key,

    column2 int,

    .

    .

    .

    column N int

    )

    go

    Thanks,

    Amit Kulkarni

  • i'm lazy and use the GUI for it

    go to table, right click and design. select the column and on the bottom is the option to add identity

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply