Created On:  03 March 2011

Problem:

Program is using a SQL Server ODBC connection and is receiving a sqlcode -207 error when executing the following singleton SELECT statement:

    EXEC SQL
       SELECT
           A.Dealer
          ,A.Name
       INTO
          :TEST-Dealer
         ,:TEST-Name:TEST-Name-NULL
       FROM TEST A
       WHERE (A.Dealer = TEST-Dealer)
    END-EXEC


sqlcode -207 means "Invalid Column Name TEST"

Why is this being returned?

Resolution:

This error is caused by the missing colon character ":" in front of the host variable name TEST-Dealer in the WHERE clause.
It should look like this instead:

       EXEC SQL
       SELECT
           A.Dealer
          ,A.Name
       INTO
          :TEST-Dealer
         ,:TEST-Name:TEST-Name-NULL
       FROM TEST A
       WHERE (A.Dealer = :TEST-Dealer)
    END-EXEC
Incident #2506507