I am used to creating sequences in Oracle and then using the sequence to create a autoincrement key on a table but in SQL Server this doesn't seem as straight forward. I modified the property of my key field to INT and set the identity specification to 'Y', 1,1.
What else do I have to do to make this work?
I tried inserting data into the table assuming it would work like Oracle, but I get this error:
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'FOO_ID', table 'FOO_SQL.dbo.FOO_MAIN'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Start Free Trial