oracle has 'DESCRIBE' to get all the details of the table like wise does t/sql has any thing

后端 未结 3 1093
清酒与你
清酒与你 2021-01-16 04:56

oracle has \'DESCRIBE\' to get all the details of the table like wise does t/sql has any thing.

相关标签:
3条回答
  • 2021-01-16 05:36
    SELECT * FROM sysobjects WHERE parent_obj = (SELECT id FROM sysobjects WHERE name = 'table_name') AND xtype='PK'
    

    will show table details.

    SELECT * FROM sys.Tables
    

    will list all tables

    There is no describe equivalent. you might find this searching for MSSQL instead of T/SQL. Most people talking about Transact SQL are talking about stored procedures.

    0 讨论(0)
  • 2021-01-16 05:37

    SQL Server has sp_help/sp_helptext

    MySQL has describe

    0 讨论(0)
  • 2021-01-16 05:47

    Sql-Server's sp_help is about as close as you get for something built-in. Remeber to put the tablename in as a parameter...:-)

    EXEC sp_help 'mytable'
    

    If you're in ssms, you can r-click your query window and opt to output results to text -- it's a little easier to read the output.

    ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/913cd5d4-39a3-4a4b-a926-75ed32878884.htm

    Also -- you can write your own using the system tables (sys.objects, sys.columns, ...) I think 'DESCRIBE' just gives you column name, nullable, and type... so not nearly as much as sp_help provides.

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