Parameters in SQL task

  • I have a sql task in dts package.

    I am having a select statement

    ex.

    select * from salesdate where salesdateid=?

    This works fine and allows me to have input parameter from global variable.

    But if I want to have Sql script as follows

    Declare @sdid int

    set @sdid=?

    select * from salesdate where saledateid=@sdid

    then it gives error as follows

    "access violation or syntax error"

    This is a simple example.I have a complex query where i want to have variables.

    Please help me out.

    Thanks,

    Tejal

     

     

     

     

  • Why would you want to do it that way?

    You are doing exactly the same thing as if you are declaring the value in the global variable by selecting properties/gloabl variabls and then typing in the value.

    Be aware that you can use a dynamic properties task as well. In here you can base the value of the variable to a sql query, similar to the one you are trying to do. Create a dynalic properties task. Add double click on the varible and change the type to Query rather than the dfault of ini. Then just type you query in.

    Good luck.


    ------------------------------
    The Users are always right - when I'm not wrong!

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

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