dbTalk Databases Forums  

BulkCopy master/detail id's

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss BulkCopy master/detail id's in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Darian Miller
 
Posts: n/a

Default BulkCopy master/detail id's - 11-05-2003 , 04:03 PM






Given master table of xid (identity), fa,fb, etc... and detail table(s) of
xid, f1, f2...

What's the standard practice for performing a bulk import (from another SQL
Server or file based) that handles keeping the master/detail id's in sync?
Obviously cannot keep the same ID's but do need to use the same id for the
master and child table rows...

Darian



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: BulkCopy master/detail id's - 11-06-2003 , 03:51 PM






I would BULK the files into working tables. Given that the source files
will be relational I would store the Source PK FK values as attributes of
the records you import. This way you INSERT all the parents and they look
like this

NewKey OldKey
1 15
2 19
3 16

Etc etc

You can then match up the Ids in the working table with the old key
attribute and assign the new key attribute.

Make sense.

--
--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Darian Miller" <darian-remove- (AT) darianmiller (DOT) com> wrote

Quote:
Given master table of xid (identity), fa,fb, etc... and detail table(s) of
xid, f1, f2...

What's the standard practice for performing a bulk import (from another
SQL
Server or file based) that handles keeping the master/detail id's in sync?
Obviously cannot keep the same ID's but do need to use the same id for the
master and child table rows...

Darian





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.