I have a scalar value function that I created to calculate aging and I want to make it apart of my SSIS package that I run monthly. How do I go about making this work?
3 Answers
If you mean you have a t-sql function that you would like to call in a data flow somehow, then that is not something you can actually do. Your have the following options:
Write the function as an SSIS expression and make the calculation in a derived column. This can be less than ideal if the function was complex.
Write a function in a script task and use a script transformation. This works well if the function is relatively simple, but isn't easily reusable.
Create an assembly that you then reference in a script transformation. You could also use this underlying code to create a CLR function on the server. This makes it easier to manage the code, but it requires more overhead to implement.
Load the data into a staging table in a database and then use the function when you try to merge the data into your final destination table. The benefit of this approach is that it is the easiest to implement. The downside of this approach is that you have to write the data to disk twice, so you are bound to get worse performance than if you used any of the other solutions.

- 8,357
- 8
- 49
- 65
I'm guessing it's a scalar function in a MS sql database. Use it in the SQL Command in a Data Flow Source in a select statement.
Select dbo.myFunction(myParam)
From myTable

- 21
- 3
Use the OLEDB Command Transformation, as per here:
SSIS return value of Stored Procedure within an OLE DB Command
Modify as required.
-
This can work, but it does not perform well. This basically calls the database for every individual row which definately won't scale. Am I missing something? – Registered User Sep 15 '11 at 23:09