Find the number of columns in a table

Though its a rare situation when we need to know the number of columns in a table. You can get the number of columns information for a particular table by running the following query on SQL Server


SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_catalog = 'Your_Database_Name
AND table_name = 'Your_Table_Name'


Good luck!


Comments

Popular posts from this blog

Top 5 AI Tools Every Developer Should Use to Boost Coding Efficiency

How To Generate Random Dates Between Two Date Range in SQL Server