Get table property

some table properties are in the new SQL Server version

SELECT OBJECT_NAME(t.[object_id]) AS [ObjectName]
	,p.[rows] AS [Table Rows]
	,p.index_id
	,p.data_compression_desc AS [Index Data Compression]
	,t.create_date
	,t.lock_on_bulk_load
	,t.is_replicated
	,t.has_replication_filter
	,t.is_tracked_by_cdc
	,t.lock_escalation_desc
	,t.is_filetable
	,t.is_memory_optimized
	,t.durability_desc
	,t.temporal_type_desc
	,t.is_remote_data_archive_enabled
	,t.is_external -- new for SQL Server 2016
FROM sys.tables AS t WITH (NOLOCK)
INNER JOIN sys.partitions AS p WITH (NOLOCK) ON t.[object_id] = p.[object_id]
WHERE OBJECT_NAME(t.[object_id]) NOT LIKE N'sys%'
ORDER BY OBJECT_NAME(t.[object_id])
	,p.index_id
OPTION (RECOMPILE);




Spread the love

1 thought on “Get table property”

  1. Pingback: Database property Himanshu Patel SQL Server Consultant developer & Administrator -

Comments are closed.