Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Need to list all columns,table names used in T-SQL Query Expand / Collapse
Posted Monday, September 17, 2012 3:10 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, March 29, 2016 4:24 PM
Points: 56, Visits: 319
Hi All,

Recently we are planning to do some schema level changes to few tables, so now i have to find out all the depended scripts/SSRS reports/SSIS packages which are using those columns.
we have around 60 reports and around 20+ T-SQL scripts.

As its regular task as part of dev cycle my manager asked me to create report with all Object References to packages/SSRS

To be more clear the Object references report will have below fields

BI Type Name TableNames ColumnNames
SSRS Report1 SimpleTable1 Col1,Col2,COl3
SSRS Report1 SimpleTable2 COl4,Col5,COl7
SSIS Package1 Table5 Col6,Col1

Please let me know if there is any automated way to find reference fileds.

I know there is way to find out related tables in a Stored procedure but is there any way i can find column names also ?

Post #1360469
Posted Tuesday, September 18, 2012 6:54 PM

Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, February 24, 2016 6:28 AM
Points: 3,977, Visits: 6,431
That's going to be quite a challenge if it is possible at all.

You might want to look at this recent thread:

Look for the suggestion by Eugene Elutin to generate and parse the XML query plan. It may be possible to do what you want to do that way, then again maybe not.

And by all means, pay homage to Mona at the end.

My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
My temporal SQL musings: Calendar Tables, an Easter SQL, Time Slots and Self-maintaining, Contiguous Effective Dates in Temporal Tables
Post #1361073
Posted Tuesday, September 18, 2012 8:19 PM



Group: General Forum Members
Last Login: Yesterday @ 9:26 PM
Points: 23,522, Visits: 37,753
Duplicate post. Please post all further responses here.

Please, don't make duplicate posts, it just fragments your answers to your questions. Most people that help here either subcribe to specific forums, or use the Recent Posts or Active Threads links to monitor questions.

Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1361094
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse