|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 8:09 AM
Points: 1,558,
Visits: 1,396
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 15, 2011 3:28 AM
Points: 2,
Visits: 26
|
|
Very smart, elegant, beautiful solution/idea. Thank u for sharing ur brain power with us, thanks a lot.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 10:20 AM
Points: 47,
Visits: 221
|
|
Thank you for that.
Those tables not involved in any relationships are not displayed (by design), but to display them simply add this snippet just before the script displays the final answer:
-- Add to answer table those tables involved in no relationships (ie. what's left) -- Use -1 as Level INSERT INTO tblAnswer([Level], A) SELECT -1, name FROM dbo.sysobjects WHERE OBJECTPROPERTY(id, N'IsUserTable') = 1 AND name NOT IN ('sysdiagrams','tblPreorder','tblAnswer') AND name NOT IN ( SELECT DISTINCT A FROM tblAnswer )
R Glen Cooper glencooper.tel
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 7:28 PM
Points: 135,
Visits: 355
|
|
Excellent script. I needed to drop most of the tables in database, in RI order. This is exactly what I need.
Thanks!
|
|
|
|