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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Foregn key problems

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-10 : 08:36:35
Andris writes "Hi all,

Currently I develop an application that uses SQL Server and I am having problems in installation of this solution on other server. The problem is that tables are linked with foregn keys and contain default data. I have exported data in MS ACCESS, but when I recreate table structure on another server and I try to import this data, I get an FOREGN KEY error.
Does anyone knows about any way to import data to empty database and skip foreign key checking during it?

Thanks for any advice."

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-10 : 11:18:05
-- Disable the constraint
ALTER TABLE tableName NOCHECK CONSTRAINT Column name

do inserts

-- Reenable the constraint
ALTER TABLE tableName CHECK CONSTRAINT Column name

also this is a helpfull place:
http://www.nigelrivett.net/


Go with the flow & have fun! Else fight the flow
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-09-10 : 12:15:12
Doesn't bcp ignore contraints unless specified?

How ar you "importing" the data?



Brett

8-)
Go to Top of Page
   

- Advertisement -