–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