Show create table tablename in SQL Server

后端 未结 3 733
心在旅途
心在旅途 2020-12-10 11:09

In MySQL it is possible to do show create table tablename

What is the SQL Server equivalent?

相关标签:
3条回答
  • 2020-12-10 11:43

    if multiple database and schema exists in SQL_Dataserver, Then you need to provide the exact table location with sp_help within single quotes.

    exec sp_help 'database_name.schema_name.table_name'
    
    0 讨论(0)
  • 2020-12-10 11:52

    In SSMS, right-click on the table node and "Script Table As" / "Create".

    There is no built in 'script this table' T-SQL.

    sp_help 'tablename' gives useful table information if that'd do.

    0 讨论(0)
  • 2020-12-10 12:02

    One that might be close:

    exec sp_columns YourTableName
    
    0 讨论(0)
提交回复
热议问题