To get total number of columns in a table in sql

后端 未结 9 1318
清酒与你
清酒与你 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:15

    SELECT COUNT(COLUMN_NAME) 
    FROM INFORMATION_SCHEMA.COLUMNS 
    WHERE TABLE_CATALOG = 'database' AND TABLE_SCHEMA = 'dbo'
    AND TABLE_NAME = 'table'     
    

提交回复
热议问题