When I edit the information from a database table from my program I have made,
I get this error:
Cannot update identity column 'ID'.
How do I SET IDENTITY_INSERT To ON?
I guess Identity is auto generated
Please post SQL questions in the SQL forums.
Also check out Microsoft's books online for help with TSQL syntax.
Syntax:
SET IDENTITY_INSERT [ database_name . [ schema_name ] . ] table { ON | OFF }
Example Usage:
SET IDENTITY_INSERT tempdb.dbo.#Temp ON
Runnable Example:
IF OBJECT_ID('tempdb..#Temp', 'U') IS NOT NULL DROP TABLE #TEMP
CREATE TABLE #Temp
(
ID int identity(1000, 1) PRIMARY KEY
)
SET IDENTITY_INSERT tempdb.dbo.#Temp ON
insert into #temp (id) values (5)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.