I have hundreds of user tables and each tables has lots of columns. Sys.Columns is returning 16000
columns; whereas INFORMATION_SCHEMA.COLUMNS is returning about 15,000
.
Question: Why the above two functions are returning such different counts? Using Sys.Columns
, how can we get the columns of ONLY
all user tables in a Database?
SELECT COUNT(*) FROM sys.columns --16,000
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS --15,004