467,926 Members | 1,486 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

Copying Parent and Child Records - SQL Server 2005

I recently had a problem requiring me to locate and copy all records pertaining to a particular client from numerous tables in a database on a given server to tables within an identical database on another server.

In essence;

Given a particular ClientID (primary key in a top-of-the-hierarchy table), I needed to be able to obtain all records in all tables (maintaining referential integrity) that pertain to the particular ClientID and copy them into the table with the same name on a destination server which contains an identical database.

I think I have found a solution to this, but being new to TSQL I am not sure it is the most efficient solution. It is currently taking about 11 seconds to execute and I am not sure how it would scale with database size and complexity.

More information on the problem and the source files are available here;

http://teenylookatcode.blogspot.com/2008/11/stored-procedure-for-copying-parent-and_03.html

I wondered if I may have overlooked anything?

Thanks,
Dawn
Nov 3 '08 #1
  • viewed: 1093
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Rick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.