Monday, March 12, 2012

Import data from MS SQL Server - error

I have a remote database which I need to make a local copy of. I have sucessfully scripted the db and created it locally. however I cannot import the data to the local server. I get this error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot truncate table

i think i am doing everything ok but it still wont work.dbo.xxx beacause its being referenced by a foreign key constraint.

Any ideaas welcome.

Gary


Apparently, the process is attempting to TRUNCATE the table -and since there is an established PK-FK relationship on the table, TRUNCATE will not work.


You can either
(a) DROP the FK CONSTRAINT, inport the data, recreate the FK CONSTRAINT, or
(b) USING "DELETE FROM MyTable", remove all of the rows of data, or
(c) Load the Parent table first before loading the child table.

|||

my question is why don't u use backup/restore method to get the database created localy. the only reason for not doing so is .. you don't want all the object created in the local copy... if that is the case then ok... otherwise go for backup/restore method

Madhu

No comments:

Post a Comment