54down voteaccepted

In SQL Server, it’s not a separate datatype (“autoincrement”) – but you can define an INT column to be an IDENTITY.

How are you creating your table – visual designer or T-SQL script??

In T-SQL, you would use:

CREATE TABLE dbo.MyTable(ID INT IDENTITY(1,1) ......

and in the visual table designer, you need to check:

alt text

It’s an option for a column of type INT – you can define the seed (starting value) and the increment – typically both are set to 1.

Advertisements