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 |
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-06-04 : 08:43:03
|
I forgot to turn the identity seed on in a table that has a lot of data in it. I created a new table and tried to copy the data from the old table to the new one where I have the identity seed on. I tried this:SET IDENTITY_INSERT weeklydiariesnc ONInsert into weeklydiariesnc select * from weeklydiariesfileIt's not working. I'm getting:An explicit value for the identity column in table 'weeklydiariesnc' can only be specified when a column list is used and IDENTITY_INSERT is ON.What am I doing wrong? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-04 : 09:16:39
|
SET IDENTITY_INSERT weeklydiariesnc ONInsert into weeklydiariesnc (col_list)select * from weeklydiariesfileMadhivananFailing to plan is Planning to fail |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-06-04 : 09:35:41
|
Thank you that's it! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-04 : 09:39:04
|
quote: Originally posted by JJ297 Thank you that's it!
Points1 When you use IDENTITY_INSERT ON, you need to list out all the columns2 When it is off, you need to list out all but identity columnMadhivananFailing to plan is Planning to fail |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-06-04 : 09:59:16
|
Thank you for the points. I will remember that for now on. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-04 : 10:04:03
|
quote: Originally posted by JJ297 Thank you for the points. I will remember that for now on.
You are welcome MadhivananFailing to plan is Planning to fail |
|
|
|
|
|