get basic SQL Server table structure information

后端 未结 6 2004
心在旅途
心在旅途 2021-02-05 04:21

I can get the number of columns in an SQL Server database with this:

SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = \'Address\'
6条回答
  •  天涯浪人
    2021-02-05 04:46

    sp_help will give you a whole bunch of information about a table including the columns, keys and constraints. For example, running

    exec sp_help 'Address' 
    

    will give you information about Address.

提交回复
热议问题