Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I know to take number of rows using select count(*) from tbl_name;
But How to find count of columns of a table
Posted
Updated 15-Oct-10 23:16pm
v2

1 solution

Try this:
SQL
SELECT count(*)
FROM information_schema.columns
WHERE table_name = '<table_name>'
 
Share this answer
 
Comments
Sandeep Mewara 16-Oct-10 5:09am    
Just to add, not sure of it would work on SQL2000 or not. That's too old an version to confirm for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900