Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IDENTITY_INSERT??

Status
Not open for further replies.

csiwa28

Programmer
Joined
Apr 12, 2001
Messages
177
I am trying to write to a SQL database and I received the following error:


"Cannot insert explicit value for identity column in table 'members' when IDENTITY_INSERT is set to OFF"


What exactly is IDENTITY_INSERT and i'm assuming i would need to turn it on. How would I go about doing so. Any help would be greatly appreciated.
 
from SQL SERVER BOOKS ONLINE
SET IDENTITY_INSERT
Allows explicit values to be inserted into the identity column of a table.


This allows you to manually add a value to a collumn defined as an IDENTITY/auto-incrementing column (one that SQL SERVER will fill automatically). Generally you don't want to do this... but yes you would have to turn IDENTITY_INSERT on before executing any sql and then turn if off when done.
 
So it's like the autonumber field in Access correct?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top