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
 SQL Server Development (2000)
 Which Table has to be loaded first ???

Author  Topic 

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2010-04-11 : 04:19:42

Hi,

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
A,B,C

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

Kristen
Test

22859 Posts

Posted - 2010-04-11 : 06:35:16
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
   

- Advertisement -