I accidentally deleted a row in the database and I would like to insert a row again. The problem is that the primary key is set to auto increment and the IDENTITY INSERTvalue is set OFFto the table. I would like to temporarily enable the identity insert so that I can insert the deleted row and then disable the identity insert.
In SQL Server Management Studio, I tried to do the following:
SET IDENTITY_INSERT myTable ON
INSERT INTO myTable (id, name, value)
VALUES (241, 'hello', 'hello2')
SET IDENTITY_INSERT myTable OFF
The first line fails:
Msg 8105, Level 16, State 1, Line 2
"myTable" is not a user table. Cannot perform SET operation.
Any idea why?