get column info from object using sql sys tables

–get column info like column name and column type
SELECT Table_Schema, Table_Name, Column_Name, Data_Type
FROM information_schema.columns
WHERE table_name in ( select name from hha..sysobjects where xtype = ‘V’ and name like ‘@objectname’ )

– get table name from field name
SELECT Table_Schema, Table_Name, Column_Name, Data_Type
FROM information_schema.columns
WHERE table_name in ( select name from hha..sysobjects where xtype = ‘U’)
and column_name like ‘%@columnname%’

Advertisement

Post a Comment

Required fields are marked *
*
*

Follow

Get every new post delivered to your Inbox.