Created
July 8, 2015 15:35
-
-
Save jbnv/f2e3a553a21999566167 to your computer and use it in GitHub Desktop.
Return the primary key for a particular table. (SQL Server)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT column_name | |
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE | |
WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1 | |
AND table_name = '<tableName>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment