List all Constraints in Sql Server

Hi All,
          Yesterday, I was facing a problem. Actually I was to rename all the constraints as our Standards. When I create tables in query analyzer, Sql Server create Constraints name itself. Now, I have to change all constraints according to naming conventions. This is the below script by which I get all the constraints in my database.


SELECT OBJECT_NAME(OBJECT_ID) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName,  OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType
FROM sys.objects WHERE type_desc LIKE '%CONSTRAINT'

Above script list all constraints. But If I want to see only Primary keys or Foreign Keys or default constraints the I will use the where clause like this:


SELECT OBJECT_NAME(OBJECT_ID) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType
FROM sys.objects WHERE type_desc = 'PRIMARY_KEY_CONSTRAINT';


SELECT OBJECT_NAME(OBJECT_ID) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType
FROM sys.objects WHERE type_desc = 'FOREIGN_KEY_CONSTRAINT';


SELECT OBJECT_NAME(OBJECT_ID) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType
FROM sys.objects WHERE type_desc = 'DEFAULT_CONSTRAINT';


SELECT OBJECT_NAME(OBJECT_ID) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType
FROM sys.objects WHERE type_desc = 'UNIQUE_CONSTRAINT';


I hope this will be very useful to see all database constraints.