|
|
Question : can you get the alias of a column in a view with INFORMATION_SCHEMA
|
|
I am using INFORMATION_SCHEMA.VIEW_COLUMN_USAGE to return the tables and columns that are used in a view, some of the columns may be aliased, i am trying to find out what the column may be aliased as using INFORMATION_SCHEMA. any help would be much approciated.
|
Answer : can you get the alias of a column in a view with INFORMATION_SCHEMA
|
|
select tc.table_name, tc.column_name , vc.table_name, vc.column_name from INFORMATION_SCHEMA.COLUMNS tc join INFORMATION_SCHEMA.VIEW_COLUMN_USAGE vu on vu.table_schema = tc.table_schema and vu.table_name = tc.table_name and vu.column_name = tc.column_name join INFORMATION_SCHEMA.COLUMNS vc on vc.table_schema = vu.view_schema and vc.table_name = vu.view_name and tc.ordinal_position = vc.ordinal_position
where vc.table_name = 'eev'
|
|
|
|