Hello,
Question: In SSIS 2008, how is it possible to store a recordset of T-SQL commands and then execute them later in the package?
Background: I'm using a Transfer Database Task to copy a database from Server A to Server B, but I had to manually correct the newly-created orphan users and re-add the intended users and add them back to their respective roles on Server B. With the goal of adding these two steps to the package so it's done as part of the Job, I created a query (#1) that generates a "If-user-exists-then-drop-user" T-SQL command for each user and another query (#2) that generates a "If-user-does-not-exist-then-create-user" T-SQL command in one column and "EXEC sp_addrolemember" T-SQL commands in another column for each user. So my order of operations should be: 1) execute script #2 and store the results, 2) run the database transfer task, 3) execute script #1 and store the results, 4) execute the stored results of script #1, 5) execute column 1 of the stored results of script #2, 6) execute column 2 of the stored results of script #2.
(I recognize that, for simplicity, I could break out script #2 into two scripts that return one column each and then split step 6 into steps 6 and 7.)
Thanks for your help!
-Eric