Variables in SQL Command

  • Hi friends,

    i am using this dynamic query in the expressions....when i try to use this one from OLEDB source using sql command from variable..it says "Statement could not be prepared. Incorrect syntax near '=' " I don't know where i am doing mistake with this..Help me friends....

    "SELECT '1355' As JurisId, 'TRA' AS ModCode,ci.atoCitation AS ModIDRef, 'V' AS RecType, 0 AS Seqno, 0 AS VecType

    , CASE WHEN txtRegState IS NULL AND SUBSTRING(p.txtNumber, 3, 1)

    = '-' THEN RIGHT(txtNumber, LEN(txtNumber) - 3) ELSE txtNumber END AS PlateNbr, CASE WHEN txtRegState IS NULL AND SUBSTRING(p.txtNumber, 3, 1)

    = '-' THEN substring(p.txtNumber, 1, 2) ELSE txtRegState END AS State, p.txtVin AS VinNbr, p.txtColorId AS Color1, p.txtMakeId AS Make, p.txtModel AS Model,

    p.txtVYear AS VehYear, p.txtRegYr AS ExpYear, p.txtPlateType AS PlateType

    FROM dbo.tblCitation AS ci INNER JOIN

    dbo.tblIncProperty AS p ON ci.atoCitation = p.lngCitation INNER JOIN

    OzaukTippsSrcPolice

    .dbo.SrcTraCE AS s ON s.CeIDRef = ci.atoCitation and s.JurisID = " + @[User::JurisID]

    Thanks,
    Charmer

  • What is the value of @[User::JurisID] at runtime?

    John

  • John Mitchell-245523 (1/12/2012)


    What is the value of @[User::JurisID] at runtime?

    John

    Thanks for the response buddy....it worked...

    Thanks,
    Charmer

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

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