2 Replies Latest reply: Feb 24, 2014 2:11 AM by Paolo Guidolin RSS

    Error using variable in SQL script

    Paolo Guidolin

      Hello, I'm trying to use variable vART in the sql script


           SQL

              SELECT ITMREF_0, SUM(QTYSTU_0) AS QTYSTU FROM x145.JOLLY.STOJOU WHERE ITMREF_0 = $(vART)

                  AND IPTDAT_0 <=  '20131231' GROUP BY ITMREF_0;

       

      but I get the following error

       

      SQL##f - SqlState: S0022, ErrorCode: 207, ErrorMsg: [Microsoft][ODBC SQL Server Driver][SQL Server]Il nome di colonna 'IBBHH001' non è valido.

      SQL

              SELECT ITMREF_0, SUM(QTYSTU_0) AS QTYSTU FROM x145.JOLLY.STOJOU WHERE ITMREF_0 = IBBHH001

        AND IPTDAT_0 <=  '20131231' GROUP BY ITMREF_0

       

      vART variable contains the item number (alphanumeric value) and it is assigned as follows:

       

        LET vART = TEXT('$(vID)');

       

       

      I attach the example document

       

       

      Can someone help me?

       

      Thanks