Use of variables in functions

  • Hi everybody, I has try the follows sentences where use in the funcion DATEADD two variables var1 and var2 but show a error. Please how I can use the variables into functions in SELECT, in the SSIS.

    SELECT DATEADD(DAY,'?','?') FEC or

    SELECT DATEADD(DAY,?,?) FEC

    The variables are declare like varchar.

    Thanks a lot!

  • Lisset (1/6/2012)


    Hi everybody, I has try the follows sentences where use in the funcion DATEADD two variables var1 and var2 but show a error.

    What's the error?

    Please how I can use the variables into functions in SELECT, in the SSIS.

    SELECT DATEADD(DAY,'?','?') FEC or

    SELECT DATEADD(DAY,?,?) FEC

    The variables are declare like varchar.

    Thanks a lot!

    Did you set them in the Parameters section? What's the object? I assume it's an Execute T-SQL component? What are you returning the results of the query to, another variable? The parameters expect an int and a datetime piece, not strings, though you can use a properly formatted date string in the datetime expectation and it will implicitly convert.

    We need a lot more detail if we are going to be able to help you, as you can see.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

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

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