Is there a way to save all queries present in a ssis package/dtsx file?
Asked Answered
H

2

1

I need to run some analysis on my queries (specifically finding all the tables which a ssis calls). Right now I'm opening up every single ssis package, every single step in it and copy and pasting manually the tables from it. As you can imagine it's very time consuming and mind-numbing.

Is there a way to do export all the queries automatically ?

btw i'm using sql server 2012

Ha answered 14/1, 2019 at 12:12 Comment(3)
wont this help? #40798239Fernand
Possible duplicate of Get SQL queries which are executed from SSIS package on SQL ServerQuadrireme
Be careful with SQL that has is built with expressions or from variables.Quadrireme
B
1

Retrieve Queries is not a simple process, you can work in two ways to achieve it:

Analyzing the .dtsx package XML content using Regular Expression

SSIS packages (.dtsx) are XML files, you can read these file as text file and use Regular Expressions to retrieve tables (as example you may search all sentences that starts with SELECT, UPDATE, DELETE, DROP, ... keywords)

There are some questions asking to retrieve some information from .dtsx files that you can refer to to get some ideas:

Using SQL Profiler

You can create and run an SQL Profiler trace on the SQL Server instance and filter on all T-SQL commands executed while executing the ssis package. Some examples can be found in the following posts:

Also you can use Extended Events (has more options than profiler) to monitor the server and collect SQL commands:

Blast answered 14/1, 2019 at 18:53 Comment(0)
C
0

You could create a schema for this specific project and then have all the SQL stored within views on that schema... Will help keep things tidy and help with issues like this.

Crescentia answered 14/1, 2019 at 16:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.