pass package name to sproc

  • I created a ssis package to do import by using SQL task , and it calls a stored procedure that basically a merge statement to compare data to insert and update.

    In my destination table, I have a createdby column, I want the packagename to be populated.

    So it is nice that the package name variable [System::PackageName] can be passed as a parameter to call the sproc, then in the sproc I can use insert createdby= packagename.

    How can I achieve this?

    Thanks

  • Just add a parameter to the sproc for that data and map the package variable into the parameter.

    CEWII

  • Thanks, I have added the parameter to stored procedure, but I cannot make the ssis part correct, can you tell me a little in detail how I can make this work.

    I use the following in SQL task- SQL Statement direct import, but it gives error.

    Declare @packagename=[System::PackageName]

    Exec dbo.domProductCategory_LoadMerge

    @packagename

    Go

  • Assuming you are using a Exec SQL task.

    Command would be:

    EXEC dbo.domProductCategory_LoadMerge ?

    GO

    On the Exec SQL Task, Parameter Mapping Tab, click add

    For Variable Name Select: System::PackageName

    Direction: Input

    Data Type: varchar

    Paramter Name: 0 << The number ZERO

    Click OK

    It is now mapped.

    CEWII

  • Elliott Whitlow (12/5/2011)


    Assuming you are using a Exec SQL task.

    Command would be:

    EXEC dbo.domProductCategory_LoadMerge ?

    GO

    On the Exec SQL Task, Parameter Mapping Tab, click add

    For Variable Name Select: System::PackageName

    Direction: Input

    Data Type: varchar

    Paramter Name: 0 << The number ZERO

    Click OK

    It is now mapped.

    CEWII

    Yeh, it works perfectly. One more question, so the parameter starts with 0, if there are a second parameter, I will put 1, is that correct? and I also see a parameter size with -1 there, I don't need to change that,even it has two parameters, is that corect?

    Thanks

  • Yes the second parameter would be 1 for Parameter Name, the -1 as I understand it means to determine it automagically.. I rarely change that..

  • Thanks a lot!

  • You are very welcome.

    CEWII

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply