![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Dear Andrea, My understanding of your issue is: You encountered the foreign keys checking error when you export your SQL Server 2000 database via Export Wizard. The error message indicated that a null or zero value is allowed in that particular field and doesn't match an ID in the corresponding lookup table. You need to manually add the WITH NOCHECK statement to avoid checking the foreign keys. You want to know if there is a way to let the export wizard not check foreign keys. If I have misunderstood, please let me know. I don't understand why some foreign keys fileds are allowed to be null. Generally, such design is not recommended. Anyway, for your question, I recommend that you add the "WITH NOCHECK" option or the "NOCHECK CONSTRAINT constraint_name" option to the "ALTER TABLE ..." statement. No global stored procedure can help you disable the constraint checking, however you may create a stored procedure to do that, such as: CREATE PROCEDURE sp_removecheck (@tablename varchar(100), @constraintname varchar(100)) AS declare @strRemoveCheck varchar(400) set @strRemoveCheck = 'ALTER TABLE ' + @tablename+' NOCHECK ' + @constraintname EXEC(@strRemoveCheck) Also, I think it's not necessary to have such constraints existed since the foreign key fields are allowed to be null. If you have any other questions or concerns, please feel free to let me know. It's my pleasure to be of assistance. Charles Wang Microsoft Online Community Support ================================================== ==== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from this issue. ================================================== ==== This posting is provided "AS IS" with no warranties, and confers no rights. ================================================== ==== |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Dear Velvet, I need to establish a test environment for further research. Could you please mail me (changliw (AT) microsoft (DOT) com) a testable database backup file and more information on reproducing your issue? Sincerely, Charles Wang Microsoft Online Community Support |
#6
| |||
| |||
|
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |