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.

Finding Table Column Count in SQL Server

The total number of columns in which it is seen has been brought.

Good luck to everyone in business and life.

205 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!