Reputation:
There is a view that has been created in the database, referencing columns of other tables in the same database. How I can find the sources of columns within the view?
For example, Info_View
has 4 columns: Name
,Surname
, Job
and Hobby
. These columns bind from different tables. How can I know which column comes from where?
Upvotes: 0
Views: 3462
Reputation: 1283
SELECT view_name, Table_Name
FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
WHERE View_Name = '<giveViewName>'
ORDER BY view_name, table_name
got it from here
Upvotes: 1
Reputation: 1888
for sql server
http://www.codeproject.com/Articles/38560/Overview-of-View-in-SQL-Server-2005
for postgresql
http://www.postgresql.org/docs/8.2/static/sql-createview.html
for mysql
http://www.mysqltutorial.org/mysql-views-tutorial.aspx
Upvotes: 0