magritton
4/8/2015 - 12:09 PM

SQL determine if column is an identity column and also finds the column type.

SQL determine if column is an identity column and also finds the column type.

SELECT t.name AS table_name,
--SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name,
c.system_type_id,
t1.name,
c.is_identity
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.object_id
LEFT outer JOIN sys.types t1
ON t1.system_type_id = c.system_type_id
WHERE t.name = 'CEFPInspectionLeakage'