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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Can not turn ENTITY_INSERT Table ON.

Author  Topic 

zubamark
Starting Member

23 Posts

Posted - 2009-06-19 : 11:44:56
Hi,

I tried to execute in SQL Server 2005 Query Analyzer the following statement:

SET IDENTITY_INSERT MyTable ON
insert into MyTable values(3508,'06/07/2009')

AND GOT ERROR:Msg 8101,....

The first column is IDENTITY column.
How to get permission to execute this statement or set identity on?

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2009-06-19 : 12:11:36
Have you tried specifying the columns in your INSERT statement?

Like this:

INSERT INTO MyTable (col1, col2) VALUES (3580,'06/07/2009')

Not sure if it'll work but it's something to try.

Some days you're the dog, and some days you're the fire hydrant.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-20 : 02:16:28
it should work fine if you specify the column list specifically like Skorch showed you
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2009-06-21 : 20:33:04
It's normally a really, really bad idea to insert into an IDENTITY column. Why are you trying to do so?

--Jeff Moden
"Your lack of planning DOES constitute an emergency on my part... SO PLAN BETTER! "
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row"

For better, quicker answers, click on the following... [url]http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]
Go to Top of Page
   

- Advertisement -