Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
starnold
Yak Posting Veteran
83 Posts |
Posted - 2008-10-07 : 11:56:37
|
| I am trying to insert a new row into a table that has an identity set on the id. The table is called Groups and my query is:USE TEST INSERT INTO Groups (GroupId,GroupName) VALUES ('9','TEST')But because the GroupID is an identity it gives me the following error:Cannot insert explicit value for identity column in table 'Groups' when IDENTITY_INSERT is set to OFF.Is there a way to bypass this or turn it on and turn it back off? I am running this across many DB's and I want each DB to have the same GroupID/Name |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-07 : 12:17:51
|
| [code]USE TEST SET IDENTITY_INSERT GroupS ON INSERT INTO Groups (GroupId,GroupName) VALUES ('9','TEST')SET IDENTITY_INSERT GroupS OFF[/code] |
 |
|
|
|
|
|