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 |
vamsimahi
Starting Member
29 Posts |
Posted - 2008-02-26 : 14:01:29
|
I want to write a stored procedure in DTS. Where the task is to dump Orders table from Northwind Database to a New Database and also i need to change the OrderID, starting from 15000 instead of 10248.I created a table in the new database and inserted the table from Northwind to new database .But , when i am trying to update the OrderID, i get the following error:Cannot update identity column 'OrderID' |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-26 : 14:17:50
|
If you're doing this in stored procedure, useSET IDENTITY_INSERT ON before the update statement and put it back to off once update is done bySET IDENTITY_INSERT OFFif you're doing update in DTS by means of export then check option "Enable identity insert". |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-26 : 14:47:56
|
You cannot update an identity column, with or without SET IDENTITY_INSERT on.You need to set the value as you load the table, not update it after it is loaded.set identity_insert NewTable oninsert into NewTable (...col list...)select ID = ID+SomeValue , ...col list ...from OldTableset identity_insert NewTable off CODO ERGO SUM |
|
|
|
|
|