October 12, 2015 at 11:36 pm
I have a database of 900+ tables with around 3000 SPs, and views. Manually I reviewed few tables and found that tables are not referenced with FK and I applied few. There are lots of tables and SPs using them in join statement, Is there any way with which I can get each tables missing references, any DMV or other manual script which tells about this?
Shamshad Ali
October 13, 2015 at 2:06 am
Not all join conditions may be foreign key relationships. How do you know a table has to be parent table / a column should be a foreign key? Do you use same column names? is there any naming convention followed? if yes, then we can explore to query meta data tables ( sys.columns etc ) to know which are potential foreign key candidates.
Regards,
Raj
October 13, 2015 at 11:29 am
arr.nagaraj (10/13/2015)
Not all join conditions may be foreign key relationships. How do you know a table has to be parent table / a column should be a foreign key? Do you use same column names? is there any naming convention followed? if yes, then we can explore to query meta data tables ( sys.columns etc ) to know which are potential foreign key candidates.
Yes, I know, not all joins could be FK, but if it finds such joining used in between tables, we can ignore upon our choice similar to those indexes which sometimes are not valid and we ignore them... In general if ther is any? Let me update, if you have its solution working?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply