While making the
SQL Table
, you can make the required column Autoincrement(Identity=true), the column must be of
int
datatype. Then when ever the data is inserted into the table. The column automatically increment the set value.
try to create this table.
CREATE TABLE [dbo].[testtable](
[userid] [int] IDENTITY(1,1) NOT NULL,
[username] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Thanks