I'm using SQL Server 2012, I want to add an auto-increment to my primary key I don't know the exact syntax so i tried this but it obviously won't work !
Help please !!!
ALTER TABLE dbo.Equipe alter numero_equipe add IDENTITY(9999,1)
I'm using SQL Server 2012, I want to add an auto-increment to my primary key I don't know the exact syntax so i tried this but it obviously won't work !
Help please !!!
ALTER TABLE dbo.Equipe alter numero_equipe add IDENTITY(9999,1)
The way to solve syntax problems is not to shove characters around until it happens to work, but to read the (excellent) online docs. They specify syntax and give examples. Searching also helps to answer trivial questions.
You can perform the operation without touching table data using SWITCH
: http://blogs.msdn.com/b/dfurman/archive/2010/04/20/adding-the-identity-property-to-a-column-of-an-existing-table.aspx
A connect item for a feature request exists: https://connect.microsoft.com/SQLServer/feedback/details/800127/allow-for-changes-to-the-identity-property-with-simple-syntax-and-metadata-operation-like-performance (please vote).