SQL AUTO-INCREMENT in SSMS

0

I have exported a PhpMyAdmin database. When I open the document that I generated when exporting with Microsoft SQL Server Management Studio , it shows me the queries of all the tables and data in the database (so far). Since some of the instructions do not seem compatible between PhpMyAdmin and SSMS . I have had to modify them and execute them by hand and most of them have been executed well, but when I have to indicate the fields AUTO-INCREMENT I get an error.

For example when executing the instruction:

ALTER TABLE  categories 
MODIFY Cat_Id  int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

I get the error:

  

Msg 102, Level 15, State 1, Line 1306   Incorrect syntax near 'MODIFY'.

How to solve this error?

    
asked by gmarsi 18.05.2017 в 17:56
source

1 answer

1

I have not tried it, but in SQL server the column is not autoincrement, it is IDENTITY and it is used in the following way:

ID int IDENTITY(1,1)

where in parentheses are (numero inicial, incremento) .

I do not know if you are going to let you do an alter table, but you are already using an instruction that does not correspond.

    
answered by 18.05.2017 / 18:10
source