I have written a program to insert the values into datbase and a field named SNO which should be auto incremented whenever an insert happens. I have aready created a table but did not set SNO as increment!!

Kindly help to set this constraint in SQL !!

Query:

Alter table dbo.master alter column SNO int NOT NULL AUTO_INCREMENT;

Error : Incorrect syntax near 'AUTO_INCREMENT'.

Either edit the column via table Structure panel,
Or run the following SQL query:

ALTER TABLE 'workers' CHANGE 'id' SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT
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.