|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 2:01 PM
Points: 1,559,
Visits: 1,404
|
|
|
|
|
|
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: Wednesday, June 05, 2013 11:09 AM
Points: 48,
Visits: 225
|
|
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 @ 8:42 AM
Points: 135,
Visits: 358
|
|
Excellent script. I needed to drop most of the tables in database, in RI order. This is exactly what I need.
Thanks!
|
|
|
|