Having inherited a legacy Sql server database, I’d like to list by table all integer columns where there is no foreign key, on the basis that some will be missing an FK, and some will just be integer columns. Can anyone suggest a query to display this information? Clearly there’s some human intervention involved here.
Thanks.
You can get it from information_schema. I would start with something like this: