[dba-SQLServer] SQL error in Excel query to IBM DB2 data source

Gustav Brock gustav at cactus.dk
Fri Apr 29 11:40:13 CDT 2016


Hi Mike

I guess the alias should be non-quoted: 

    KMRL01.MRLDT AS ArrivalDate

/guess

-----Oprindelig meddelelse-----
Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] På vegne af Zimmer, Michael
Sendt: 29. april 2016 18:33
Til: dba-sqlserver at databaseadvisors.com
Emne: [dba-SQLServer] SQL error in Excel query to IBM DB2 data source

Hi all,

We have an odd situation:  A query using data from an ODBC connection runs fine on our Win 7 PCs with Excel '07.  However, the query can only be edited on one machine, on all others editing the query returns this error:

"SQL0104 - Token 'ArrivalDate' was not valid. Valid tokens: <IDENTIFIER>."

In the query we have a data field called "MRLDT" and we renamed it to "ArrivalDate" so that it is meaningful to the end users.

Here is the SQL statement for the query:
SELECT KMRL01.MPROD, KMRL01.MRLDT AS 'ArrivalDate', KMRL01.MRDTE AS 'ShipDate', right(MPRNT,6) AS 'Location', KMRL01.MQTY FROM MAN400.BPCSF9.KMRL01 KMRL01 WHERE (KMRL01.MPROD='750197') AND (KMRL01.MRDTE<=20160615)

No matter what I've tried, I cannot find a way to amend the SQL statement so that I can edit the arrival date ranges.

However, the spreadsheet as a whole runs fine on all of our PCs.  Just no editing of queries where we rename the column headings to a meaningful title.

Thanks

Mike 




More information about the dba-SQLServer mailing list