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 2008 Forums
 SQL Server Administration (2008)
 Identity_Insert is set OFF error on new server

Author  Topic 

scholin
Yak Posting Veteran

56 Posts

Posted - 2010-01-17 : 00:19:30
I upgraded to a new server from using 2008 SQL Express to 2008 SQL standard. I did a detach from express and attach to standard on the new server.

I can work with the data just fine directly, like using Management Studio (insert, update, etc) but when I try to insert a new record from my website, I get an error saying "SQL Server]Cannot insert explicit value for identity column in table 'Reader' when IDENTITY_INSERT is set to OFF. SQL State is: 23000'". From the website I can update without problems, just can't insert.

I am thinking it must be a setting issue but can't find anything. I did change the instance name - so maybe something with that?? Just too new to SQL.

Ideas? Thanks!

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-01-17 : 04:23:36
Don't explicitly specify a value for an identity column. The whole point of identity is that it's auto assigned by SQL.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

scholin
Yak Posting Veteran

56 Posts

Posted - 2010-01-17 : 09:54:12
That is just it . . . the website and sql had been all working for the past year just fine. All I did was to moved the existing website and sql database to another server with sql standard and now I can't insert - I have not changed anything in the design. Which is why I was thinking it must be a setting change that I am overlooking.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-17 : 10:05:24
I can't understand why a column is set as an identity column while the website trys to insert the values itself.
Is the webpage coded to manage that id without autonumber?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-17 : 10:31:12
IDENTITY_INSERT is always set to off unless you explicitly set it on. This isn't due to your upgrade.
Go to Top of Page
   

- Advertisement -