Query to get the total no of columns in a given table in ms sql server database


In this programming tutorial you will learn the query to get the total no of columns in a given table in ms sql server database. Its quite easy in ms sql server. Lets have a look over the query given below

Select Count(*) As ColumnCount
From   Information_Schema.Columns
Where Table_Name = 'mytbl_name' 

So that's it. Run this query, replace the mytbl_name with your table name and enjoy.
I love your feedback.

0 comments: