To get total number of columns in a table in sql

后端 未结 9 1333
清酒与你
清酒与你 2021-01-30 13:05

I need a query in sql to get total columns in a table.Can anybody help?

9条回答
  •  面向向阳花
    2021-01-30 13:18

    The below query will display all the tables and corresponding column count in a database schema

    SELECT Table_Name, count(*) as [No.of Columns]
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE table_schema = 'dbo' -- schema name
    group by table_name
    

提交回复
热议问题