Thomas Pagel BI Blog

Microsoft BI Technology & more

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

SSIS Blogs

SSRS Blogs

SSAS Blogs

Other SQL Server Links

Subscriptions

Post Categories



Tuesday, January 03, 2006 - Posts

Returning Values from a Stored Procedure to the Pipeline

Perhaps not everyone knows that it’s very easy to call stored procedures from a Data Flow and return values into the pipeline.

Just take this procedure:

 

CREATE PROCEDURE dbo.sp_test

      @param1 int,

      @param2 int,

      @param3 int output

AS

BEGIN

      select @param3=@param1+@param2

END

GO

 

Well, quite trivial, but it should work as an example…

So just imagine that you have two integer fields in your pipeline and want to have these added. The result should be in the pipeline for later use (i.e. to write it into a table). So what do you have to do?

Just add a field to the pipeline (i.e. use a Derived Column transform for that assigning a default value to it).

Then you can add an OLE DB transform to call the stored procedure. The command will look like this:

 

exec dbo.sp_test ?,?,? output

 

Then you simply have to do the column mapping for the three parameters. And that’s it…

I didn’t do any performance testing on that, but it would be quite interesting how good this performs… I’m quite curious if calling a stored procedure (perhaps even some C#/VB.net code) is faster than calling a VB.net script…

 

Thomas

posted Tuesday, January 03, 2006 12:50 PM by tpagel with 0 Comments




Powered by Dot Net Junkies, by Telligent Systems