desc is sp_columns in Sql Server

In Oracle and MySql, to get the column name and data type of a table, you can use:

desc MyTable


describe MyTable

The equivalent of desc in Sql Server is sp_columns. Therefore, run the command below will get similar results:

sp_columns MyTable


  1. James Luetkehoelter Said,

    December 26, 2006 @

    FYI I’ve been working on a SQL version of DESCRIBE that would include tables, views, stored procedures and table-valued functions. I totally forgot about sp_columns. Not quite the same output (I prefer DESCRIBE) and it does just cover tables and views (which if I’m not mistake DESCRIBE does too).

    Still, thanks for pointing that out – I’ll put my DESCRIBE on a backburner and point this out to Oracle-based SQL Server students when they ask me if there’s an equivalent.

  2. Haidong Ji Said,

    December 26, 2006 @

    Thanks James.

    Yes, DESCRIBE in Oracle does cover views.

    I like the output of DESCRIBE too. sp_columns gives just a tad too much…

RSS feed for comments on this post · TrackBack URI

Leave a Comment