Technical Article

Tables NOT having FK v2

,

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

SELECT	su.name + '.' + so.name as 'TableName'
FROM	sysobjects so (nolock) inner join sysusers su (nolock)
		on so.uid = su.UId
WHERE	so.xtype = 'U' AND objectproperty(object_id(su.name + '.' + so.name),'TableHasForeignKey') = 0
ORDER	BY so.Name

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating