Get Table information (Column Name, Data Type) in SQL Server

Get Table information like Column Name, Data Type, Character length, Default Values etc in SQL Server

To get the Table in information in SQL Server,  we can use below Query:

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Users'
ORDER BY ORDINAL_POSITION

Where’ Users’ is Table Name
Output is shown in below snap:

SQL Server INFORMATION_SCHEMA.COLUMNS
SQL Server INFORMATION_SCHEMA.COLUMNS

We can use below query also:

sp_Columns 'Users'

Output is shown in below image:

sp_Columns SQL Server
sp_Columns SQL Server
Posted under category SQL Server and tagged as SQL Server on Saturday, September 18th, 2010.

Related posts

  • Mahmad Khoja

    Thanks this helped me lot to generate property based on table name.

  • Michael Hansip

    nice sharing, thank you.

  • amy

    thank you! this helped me out a bunch! now I can figure out my tables easier

  • ASHITHA

    GOODD SHARING….HELPED ME ALOT..

  • thilak

    really nice one thank you

  • henry

    Yes. see this url more details i.e. http://belearnings.com/blogs/