What is the equivalent of 'describe table' in SQL Server?

前端 未结 23 1044
一整个雨季
一整个雨季 2020-11-27 09:12

I have a SQL Server database and I want to know what columns and types it has. I\'d prefer to do this through a query rather than using a GUI like Enterprise Manager. Is the

23条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 09:45

    There are a few methods to get metadata about a table:

    EXEC sp_help tablename
    

    Will return several result sets, describing the table, it's columns and constraints.

    The INFORMATION_SCHEMA views will give you the information you want, though unfortunately you have to query the views and join them manually.

提交回复
热议问题