Finding Table Column Count in SQL Server
Hello everyone,
In this article, I will give information about finding the number of table columns in SQL Server.
In SQL Server, in some cases, we may want to find the number of columns in a table.
You can easily do this with the help of the code below. I made my transactions using the AdventureWorks database.
SELECT COUNT(COLUMN_NAME) AS TotalNumberofColumns
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'AdventureWorks'
AND TABLE_SCHEMA = 'Person'
AND TABLE_NAME = 'Address';
When you run the code, you will get a result like the one below.
The total number of columns in which it is seen has been brought.
Good luck to everyone in business and life.