0

I try to create data ODBC connection in MS Excel (on Windows) to download data from SAGE using a SQL query via **SageLine50v29 **ODBC data source.

I need to create few empty columns for later joins and etc.

The simplified code example is shown below.

Problem

The Excel SQL query does not create empty columns using "" or '' in the syntax...

Furthermore, if any NULL variation (like: Null, NULL, null) is used, - the query throws an error:

DataSource.Error: ODBC: ERROR [42S22] Column not found

Any other ways in Excel ODBC SQL query to create empty columns?

The code shown here creates table only with ONE column DEPT_NAME (no empty columns)

SELECT 
    a.DEPT_NAME, "" AS TEST_COL1, '' AS TEST_COL2, 
    NULL AS TEST_COL2, NULL AS TEST_COL3,
FROM 
    TEST_TABLE a

However, if I try to use the code below, I get this error:

DataSource.Error: ODBC: ERROR [42S22] Column not found

SELECT 
    a.DEPT_NAME, NULL AS TEST_COL2,
FROM
    TEST_TABLE a
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
NoobVB
  • 989
  • 6
  • 10

0 Answers0