Need help with an expression

  • I have 2 global variables DMNSTATUS and DMN_ID

    I get the values from a script task

    Im running an SQL TASK using expressions to pass these variables into an sql statement:

    "UPDATE TB_DMNSTAGE SET DMN_STATUS = " + @[User::DMNSTATUS] + " WHERE DMN_ID = " + @[User::DMNID]

    My problem is if DMNSTATUS = waiting for verification

    the sql statement fails because of syntax error:

    UPDATE TB_DMNSTAGE SET DMN_STATUS = waiting for verification WHERE DMN_ID = 21

    How do i get it parse the query as

    UPDATE TB_DMNSTAGE SET DMN_STATUS ="waiting for verification" WHERE DMN_ID = 21

  • Just add the single quotes in ...

    "UPDATE TB_DMNSTAGE SET DMN_STATUS = '" + @[User::DMNSTATUS] + "' WHERE DMN_ID = " + @[User::DMNID]

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Once again i mix up my vb with my sql... single quotes not double quotes!!! BAH!

  • 🙂 happens to us all

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • "UPDATE TB_DMNSTAGE SET DMN_STATUS = '" + @[User::DMNSTATUS] + "' WHERE DMN_ID = '" + @[User::DMNID] + "'"

    Gives me error:

    Error: Incorrect syntax near '18'.

    [Execute SQL Task] Error: Executing the query "UPDATE TB_DMNSTAGE SET DMN_STATUS = 'Waiting for rework notification'' WHERE DMN_ID = '18'" failed with the following error: "Unclosed quotation mark after the character string ''.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

  • Removing the single qoutes near DMNID as such:

    "UPDATE TB_DMNSTAGE SET DMN_STATUS = '" + @[User::DMNSTATUS] + "' WHERE DMN_ID = " + @[User::DMNID]

    Gives me this error:

    Error: Unclosed quotation mark after the character string 'Waiting for rework notification' WHERE DMN_ID = 18 '.

    [Execute SQL Task] Error: Executing the query "UPDATE TB_DMNSTAGE SET DMN_STATUS = 'Waiting for rework notification'' WHERE DMN_ID = 18 " failed with the following error: "Incorrect syntax near 'Waiting for rework notification' WHERE DMN_ID = 18 '.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

  • AAAANDD... I found another boo boo of mine....

    i had the ' being assigned in my script...

    I think I need a vacation...

    Ignore my previous question...

Viewing 7 posts - 1 through 6 (of 6 total)

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