List Table Columns in SQL Server

Hello to everyone,
In this article, I will give you information about how to list the columns of the tables in the database in SQL Server.

Query below lists all table columns in a SQL Server database.

SELECT SCHEMA_NAME(tab.schema_id) AS schema_name, AS table_name,
       col.column_id, AS column_name, AS data_type,
FROM sys.tables AS tab
    INNER JOIN sys.columns AS col
        ON tab.object_id = col.object_id
    LEFT JOIN sys.types AS t
        ON col.user_type_id = t.user_type_id
ORDER BY schema_name,

When you run the code you will get the following result.

List Table Columns in SQL Server

As you can see, the tables and columns are listed with their data types.

Good luck to everyone in business and life.


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!