How should my SQL-Statement (MS-SQL) look like if I wan’t to insert a row into a table, which contains only one column with the autogenerated id?
Following two queries won’t work:
INSERT INTO MyTable (MyTableId) VALUES (Null)
-- or simply
INSERT INTO MyTable
Thx for any tipps.
sl3dg3
INSERT INTO MyTable (MyTableId) VALUES (Null)implicitly tries to insert a null into the identity column, so that won’t work as identity columns may never be nullable and without a SET option you cannot insert an arbitrary value anyway, instead you can use: