Pages

Social Icons

Monday 8 October 2012

Tables with there columnname and its datatype

Below query will gives us all the tables with there columnname and its datatype from a schema.

=====================================================

SELECT Table_Schema, Table_Name, Column_Name, Data_Type
FROM information_schema.columns
WHERE table_name in ( select name from dbo.sysobjects
where xtype = 'U' )
order by table_schema, table_name

Thx,
Rahul

No comments:

Post a Comment