Jun 25th, 2009 | No Comments

Here is the SQL query that will help you list all the tables and columns along with its data type and length in a particular database.

This query fires query to the system table that stores all the information about the database.

select table_name, column_name, data_type, character_maximum_length, is_nullable from information_schema.columns where table_name in (select name from sysobjects where xtype='U') order by table_name

Hope this helps, enjoy :)

Written by Ajay Matharu

June 25th, 2009 at 10:30 am