Count how many columns in a table

Ranjeet_8
Posted by Ranjeet_8 under Sql Server category on | Points: 40 | Views : 1089
This query will display number of columns in a table.

SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your_Table_Name'

Comments or Responses

Posted by: Srilu.Nayini577 on: 8/14/2012 Level:Starter | Status: [Member] | Points: 10
We can also find the no.of columns by using below query also:


select count(*) from sys.columns where object_id=object_id('<TableName>')


Thank you,
Posted by: Pervej on: 9/12/2012 Level:Starter | Status: [Member] | Points: 10

Login to post response