October 18, 2016 at 11:58 pm
Comments posted to this topic are about the item Stairway to Exploring Database Metadata Level 4: Using the Dynamic Online Catalog to Explore Keys and Relationships
Best wishes,
Phil Factor
October 19, 2016 at 7:44 am
Thank you Mr. Factor!
This article was one of the better reads I have had in recent memory.
Regarding the FKRelationshipsFor procedure, Line 59 there is a bug whereby I think you meant to add the fk.name as a comment. 😀
-->Bug here ), 18, 2000) + CHAR(13)+CHAR(10)+ ' – ' + fk.name AS script
-->Replace with ), 18, 2000) + CHAR(13)+CHAR(10)+ ' -- ' + fk.name AS script
October 19, 2016 at 8:59 am
Yes, that seems to be a problem in the formatting. (sigh). I'll get Webmaster to change it.
Best wishes,
Phil Factor
October 20, 2016 at 10:44 am
Thanks for the article.
September 1, 2020 at 3:56 pm
Is the following correct? I think you want a property value other than "IsPrimaryKey" based on the description and the output (in the article).
Alternatively, you can use the system views to list all the constraints, as in the following query:
SELECT
OBJECT_SCHEMA_NAME(Parent_Object_ID) + '.'
+ OBJECT_NAME(Parent_Object_ID) AS TheTable,
Name
FROM sys.objects
WHERE OBJECTPROPERTYEX(object_id, 'IsPrimaryKey') = 1
ORDER BY TheTable;
------------
Buy the ticket, take the ride. -- Hunter S. Thompson
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply