0

Update, the view is not found in the sys.sql_dependencies when searching for the object ID or name of the view, I'm not sure why this is the case.

I have a view, let's call it "Window", Window pulls numerous columns from numerous different tables in my database.

What I want to do is find out the name of all the columns and all the tables it references without having to search through the SQL code, mainly because there are numerous Counts, Sums, Case Statements and Joins that make this difficult.

If I do

Select * From Sys.views
Where name = 'Window'

I find the object_id = 10

Now if I do

Select * From Sys.columns
Where object_id = 10

I get various information about the columns including the "name", the problem is this is the name I have given the column in the AS statement, not the unique column name.

My ideal result would be that I can run a Select * and find all the columns in my view, what table they are from, and what they are actually called, not what they are referenced as.

James B
  • 149
  • 2
  • 14
  • what are columns you are looking to be returned ? – Ven May 15 '18 at 14:12
  • I'm looking to return all the columns that the view references. For example Window pulls data from Table X, then from this pulls columns X1, X3, X7 and X9. But also pulls data from Table Y columns Y1, Y2, Y3, Y4. I want to be shown X1, X3, X7, X9, Y1, Y2, Y3 and Y4 in addition to tables X and Y – James B May 15 '18 at 15:33

0 Answers0