Technical Article

Tables NOT having FK v2

,

Following script lists the tables NOT having FK. (any owner)

SELECTsu.name + '.' + so.name as 'TableName'
FROMsysobjects so (nolock) inner join sysusers su (nolock)
on so.uid = su.UId
WHEREso.xtype = 'U' AND objectproperty(object_id(su.name + '.' + so.name),'TableHasForeignKey') = 0
ORDERBY so.Name

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating