How to get Table Information in SQL Server (Equivalent of Oracle’s desc)

01-06-2012

You can use following stored procedures to get table information similar to what you get by calling “Desc” in Oracle.

Sp_columns ‘<TableName>’

This will show the list of columns along with other useful information such as:

  • data type,
  • length,
  • Is-Nullable,
  • etc…

You can also use sp_help ‘<TableName>’

For even more descriptive information This will show column information such as:

  • data type,
  • length,
  • Nullable,
  • etc…

In addition this also gives you a wealth of other useful information such as:

  • Table creation time,
  • Which columns are Row Guid type (if there’s any),
  • File group,
  • List of indexes working on this table,
  • Constraints,
  • etc…

Also note that if you call the sp_help without specifying a table name (just use sp_help itself without any parameters) then it will display a wealth of information about your database such as:

  • List of tables with their owner and object type,
  • List of users,
  • etc…

 

Menol
ILT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: