Home > Code > SQL Server > Find the total no of columns in SQL server table

Find the total no of columns in SQL server table

by Thamil   on Aug 23, 2012   Category: SQL Server   |  Views: 1035    |  Points: 25   |  Gold 



Use the below query to get the total no of columns in the table

SQL server
---------------
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='tableName'

Oracle
---------------
SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME='tableName'




Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts