SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Which Table has to be loaded first ???
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

368 Posts

Posted - 04/11/2010 :  04:19:42  Show Profile  Reply with Quote


Do we have any algorithm or procedure or a user defined function to which i can pass the tables names and it should tell me the loading sequence.

For example i have 3 tables say A,B,C where A and B are master tables and C is a transactional table which references A(c1) and b(id).

If i pass the tablenames to the stored procedure/functions, it is should suggest me the loading sequence.

declare @tableList varchar(100);
set @tableList = '''C'',''A'',''B''';
exec sp_showLoadingSequence(@tableList)

--Expected output

If anyone has tried this before????????

I can go for Database diagram but if we are having large set to tables to be loaded then it is becoming great confusion. so, i thought if we can find out a way from T-SQL then it will be good.

Any thoughts will be greatly appreciated!

Thanks in Advance


United Kingdom
22712 Posts

Posted - 04/11/2010 :  06:35:16  Show Profile  Reply with Quote
There is a script somewhere here that determines the parent-child order of foreign keys - in order to allow Deletion/Truncation of child-then-parent, would that help?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000