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

, , , ,

2 responses to “desc is sp_columns in Sql Server”

  1. 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. Thanks James.

    Yes, DESCRIBE in Oracle does cover views.

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

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.