User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 427,776 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,725 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 2189 | Replies: 0
Reply
Join Date: Oct 2007
Posts: 1
Reputation: charumathi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
charumathi charumathi is offline Offline
Newbie Poster

IDENTITY_INSERT in MSSQL 2005

  #1  
Oct 29th, 2007
Hi ,

I use MSsql server 2005 with the compatability mode set to 2000.One of the tables, has an IDENTITY Column.I need to restore a earlier backed copy of the table.So, i did the following :

set IDENTITY_INSERT MYTABLE ON

insert into MYTABLE(ID,NAME) values(23,'XYZ')

However, i get the following error :

[Error Code: 544, SQL State: S0001] Cannot insert explicit value for identity column in table 'MYTABLE' when IDENTITY_INSERT is set to OFF.

Can anyone tell me why the set IDENTITY_INSERT does not work ? I need to disable the IDENTITY, do the restore and then enable the IDENTITY again.Also, i need to be able to do this only thorugh SQL issued via JDBC.Please help.

Thanks,
Charu.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 1:22 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC