Use of global variable in DTS?

  • Hello to everyone!

    After reading this article

    http://www.sqlservercentral.com/articles/DTS/2929/

    (which was very useful) I created a global variable using activeX.

    The name of the parameter is "@P1" and the code inside the activeX task is the following.

    Function Main()

    DTSGlobalVariables("@P1").Value=inputbox("Enter a string")

    Main = DTSTaskExecResult_Success

    End Function

    The user who executes the DTS inputs a string which is stored as the value of this global variable.

    My problem is that after this activeX, an SQL Task is executed, in which I want to use the value of this variable

    for example:

    insert into mytable values (@P1)

    But I get an error that implies I should declare "@P1"!

    Can anyone PLEASE help me?

  • Instead of @P1, use ?, then click on the Parameters button and when Parameter Mapping dialog displays, map P1 to Parameter1.

  • curbina (5/16/2008)


    Instead of @P1, use ?, then click on the Parameters button and when Parameter Mapping dialog displays, map P1 to Parameter1.

    I already did that but when I click on parameters button, I get an error that says the syntax is not correct!

    If anyone could PLEASE help me! It is very important to me!

    Thanks again!

Viewing 3 posts - 1 through 2 (of 2 total)

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