SQL Tips #2 - How To Determine Table Details

Sometimes, we may need to know the table's metadata like 

  1. Column Name,
  2. Data Type
  3. Column Size
  4. Index 
  5. Constraint
  6. ETC.

And to be honest there are various ways to determine this but in the tip, we are going to share 2 simple ways to determine the table's detail

1. SP_HELP

The syntax of sp_help is very simple as shown below

SP_HELP 'TABLENAME'
GO

For example, if I have a Users table in my database then I can write the SQL command like below and hit F5 

SP_HELP 'Users'
GO

How to determine Table Details

Now, the other way is very very simple. In this, you don't have to write SP_HELP 

Just write the tableName in the Query window. Select the table Name and hit ALT + F1

This will show exact same result which you get from SP_HELP.

I hope this simple tip might help you.

Thanks