Thursday, February 23, 2017

Count Columns in Table in SQL Server

SELECT COUNT(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'DbName' AND TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'TableName'  
Post a Comment