SQL create statement incorrect syntax near auto increment

auto-increment, database, sql, sql-server, sql-server-identity

Solution

It is `IDENTITY` not `AUTO_INCREMENT` in SQL Server.

Try this instead:

CREATE TABLE [dbo].[MY_TABLE] (
    [ID] INT NOT NULL IDENTITY(1, 1),
    [NAME]          NVARCHAR (100) NULL,
    [SCHOOL]             NVARCHAR (100) NULL,
    PRIMARY KEY (ID)
);

Problem

I created the following table, but I got the error below; Incorrect syntax near 'AUTO_INCREMENT'. SQL: ``` CREATE TABLE [dbo].[MY_TABLE] ( [ID] INT NOT NULL AUTO_INCREMENT, [NAME] NVARCHAR (100) NULL, [SCHOOL] NVARCHAR (100) NULL, PRIMARY KEY (ID) ); ``` I think I have done everything right. Can someone help me out?

Original source