Translate

Friday, 21 July 2017

sql : query for total no of column in a table

SELECT count(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'tblEmployee'


or

SELECT COUNT(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'master' AND TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'tblEmployee'

No comments:

Post a Comment