Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How do I set a variable value based on a SQL Query

Author  Topic 

MuadDBA

628 Posts

Posted - 2007-04-25 : 15:17:45
I have a SQL query that finds a value which I need to pass into an SSIS variable so I can use it later to set the filename for my data flow task. So far, I have been unsuccessful in determining how this is done.

google searches, etc seem to be fruitless for me, there are so many hits but none really seem to address what I want to do because there are so many things you can do with variables. Likewise the books online and the boks I have on SSIS also only give a very high level of info. I need some examples, if anyone could help I would appreciate it.

Here is the basic gist of my query:

exec SP_GET_FILE_NAME @file_name OUTPUT

I need to take the resulting @file_name and store it in an ssis variable. How?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-04-25 : 15:31:37
If you are using an Execute SQL Task, look under the Parameter Mapping "tab" on the properties dialog and you should be able to assign a variable as Output. That should get you where you need to be.

Alternitively, if you are just selecting a single value you can assign the result set right to a variable in the Result Set tab.

-Ryan
Go to Top of Page
   

- Advertisement -