Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select t.name as table_name, c.name as column_name from sys.columns c
- inner join sys.tables t on t.object_id = c.object_id
- left join sys.foreign_key_columns f on
- (f.parent_object_id = c.object_id and f.parent_column_id = c.column_id) or
- (f.referenced_object_id = c.object_id and f.referenced_column_id = c.column_id)
- where c.name like '%id' and f.constraint_column_id is null and c.column_id > 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement