Pages

Friday 30 March 2012

SQL SERVER - Different Ways To Identify Structure of a Table

We can know the structure of the table to extract the Column names, types, max length, etc. using following different methods.

In new query analyser window type the name of a table, highlight the name of the table and then press ALT + F1

EXEC SP_HELP 'TableName'

EXEC SP_COLUMNS 'TableName'

SELECT * FROM information_schema.columns WHERE table_name = 'TableName'


Generate SQL Script option from Enterprise Manager or Management Studio
On the Choose Objects page, Right click on database name -> select option 'Tasks' -> Generate Scripts select the objects to be included in the script.

No comments:

Post a Comment