|
Prev: how to strip specific email address from nvarchar field with multiple addresses
Next: Q: Linked Server and Stored Procedure
From: Ramesh Subramaniyan on 1 Jul 2008 01:35 i just want table order to create using sys.foreign_keys , because i have every table as separate object with help of this query i took those not having relationship , so these table can be created first SELECT * FROM INFORMATION_SCHEMA.TABLES a WHERE TABLE_TYPE = 'BASE TABLE' AND a.TABLE_NAME NOT IN ( SELECT OBJECT_NAME(referenced_object_id) FROM sys.foreign_keys UNION SELECT OBJECT_NAME(parent_object_id) FROM sys.foreign_keys ) similarily i just want take the parent tables first then relation tables adv thanks
From: Uri Dimant on 1 Jul 2008 01:47
Some ideas http://dimantdatabasesolutions.blogspot.com/2007/08/foreign-key-dependency.html "Ramesh Subramaniyan" <RameshSubramaniyan(a)discussions.microsoft.com> wrote in message news:9B1333F6-CB99-45BD-A6C1-C0B68A6BEA7E(a)microsoft.com... >i just want table order to create using sys.foreign_keys , because i have > every table as separate object > > with help of this query i took those not having relationship , so these > table can be created first > > > SELECT * > FROM INFORMATION_SCHEMA.TABLES a > WHERE TABLE_TYPE = 'BASE TABLE' > AND a.TABLE_NAME NOT IN > ( > SELECT OBJECT_NAME(referenced_object_id) FROM sys.foreign_keys > UNION > SELECT OBJECT_NAME(parent_object_id) FROM sys.foreign_keys > ) > > similarily i just want take the parent tables first then relation tables > > adv thanks |