Skip to content

Instantly share code, notes, and snippets.

@renatoassis01
Created June 21, 2016 16:44
Show Gist options
  • Save renatoassis01/1110a7c43bb7f3b1593665b63b8cfb73 to your computer and use it in GitHub Desktop.
Save renatoassis01/1110a7c43bb7f3b1593665b63b8cfb73 to your computer and use it in GitHub Desktop.
Check constraint primary key Sql Server
SELECT T.name 'COM PK'
FROM SYS.Tables T
WHERE OBJECTPROPERTY(object_id,'TableHasPrimaryKey') = 1 -- 1 or 0
AND type = 'U'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment