SQL Query to list all tables with Identity columns


SELECT t.name AS [Table_Name], c.name AS [Column_Name],
tp.name AS [Data_Type],c.max_length AS [Size]
FROM sys.tables t JOIN sys.columns c
ON t.object_id = c.object_id
JOIN sys.types tp ON c.system_type_id = tp.system_type_id
WHERE c.is_identity = 1
and t.name not like 't_%'
order by t.name

Comments

Popular posts from this blog

SSIS vs. T-SQL

Sync SSAS Cube From One Environment to Another

SQL Function to replace special characters from a string