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 |
|
rowter
Yak Posting Veteran
76 Posts |
Posted - 2010-06-25 : 12:46:04
|
| Hi,Identity_insert on the primary key column client_no(10000, 1)in the sql server database.Now, i am importing some data from a foxpro table and trying to insert in this table.I am getting error:cannot insert explicit value for identity column in table ' ' when identity_insert is set to off.I do not want to remove the identity insert on the column be cause i will need it. But for this import, since the data is coming from a different database they have a different sequence of client_no and we want them in our new sql server database.Any way around this problem?Thanks |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-06-25 : 12:59:40
|
| For importing purpose set it to on & then reset it to off.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
|
rowter
Yak Posting Veteran
76 Posts |
Posted - 2010-06-25 : 13:04:33
|
| I set Identity_Insert to OFF and tried . I got the same error.I set Identity_Insert to ON and tried . I got the same error. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-06-25 : 13:20:14
|
set identity_insert {table name here} oninsert targettable (identitycol, col2)values (10000, 1)set identity_insert {table name here} off N 56°04'39.26"E 12°55'05.63" |
 |
|
|
rowter
Yak Posting Veteran
76 Posts |
Posted - 2010-06-25 : 14:59:42
|
| Peso, This did not work. I get the same error when i try to insert |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-06-28 : 05:07:34
|
| Please make sure the value u r trying to insert for the column should not already exist.This is for sure the above error occurs because of this.Its just suggestion otherwise u will get another error of primary key voilation...Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
|
|
|