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
 Import/Export (DTS) and Replication (2000)
 bcp in child before parent?

Author  Topic 

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-19 : 09:20:30
Huh?

I've got good RI data...BUT..a developer loaded the tables in alpha table order....

Such that the child loaded BEFORE the parent....

Huh?

Got a test being set up now to mess with the child file to add a key that doesn't exist in the parent...

But Why is this allowed?

In DB2 you can specify

LOAD DATA REPLACE NO CHECK....

On the load card...you then need to run a check after to verify the data...

Is that what's going on? Is there such a utility in SQL Server to run a check post load?

I'm confused....

Any comments appreciated.

Thanks



Brett

8-)

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-19 : 09:25:33
You can drop the FK then add it again afterwards.
Usually the loads are much faster and you end up with less fragmentation if you remove all indexes - do loads then add all indexes.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-19 : 10:09:14
Well that's the plan...

my dba did the load before we discussed the process (ya gotta love'em when they're pro active)

But, and now I have to check, but he said it worked...loading the child before the parent.

I didn't think that was possible.

I've always, either dropped ri, or made sure I loaded in the correct order.

huh?

I'm having the test run today....

huh?

and yes Nigel...I will be dropping RI

I had too automate the bcp out, ftp up to the mainframe, generation of jcl and parameter dsns, ftp down bcp in (don't forget format cards) for 700 hundred tables...well actually 1 to n..

started with a test of Northwind...nice diveristy of crap....

works great...

Actually the DB2 option is ENFORCE NO.....

Then a CHECK utility post load...



Brett

8-)
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-05-19 : 10:22:54
I think there was a link here recently (or on sqlservercentral) that indicated that BCP ignored CHECK constraints.....which is how the RI test failed.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-19 : 12:28:04
Ok...I got -h "CHECK_CONSTRAINTS"

Which is what I don't want to do anyway...

But How do you audit the data after it's loaded to make sure there's no problem?

I guess I'll just make sure the RI is not applied like Nigel said...fatser loads, and then the plus of a failed contraint if the RI is bad...

Or generate some Code to check the RI before...anyone got that written already?



Brett

8-)
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-19 : 13:21:21
Got it...what a scrub...

DBCC CHECKCONSTRAINTS

Thanks for the help



Brett

8-)
Go to Top of Page
   

- Advertisement -