.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How to count total no. of columns in a table

Posted By: Santosh     Posted Date: October 28, 2010    Points:2   Category :Sql Server
Hi All,

How to count total no. of columns in a table...



Regards
Santosh

Responses
Author: Arul             
Posted Date: October 28, 2010     Points: 5   

SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Employee'

Author: Asha.MP             
Posted Date: October 28, 2010     Points: 5   

Hi..

you can use this query to get the columns count in the table Emp

SELECT COUNT(*) AS Count
FROM INFORMATION_SCHEMA.COLUMNS
WHERE (TABLE_NAME = 'Emp')

Thanks and Regards,
Asha.mp
Author: Ramesh P             
Posted Date: October 30, 2010     Points: 5   

Just use a simple query as given below,

Select count(column_name) from table_name

Regards,
Ramesh.

Regards,


Ramesh



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend