October 16th, 2012, 02:39 PM
-
MS Query returns sql error on when SSRS doesn't
I've written a t-sql query against a SLQ Server 2008 db which works error free when I run it in SSRS. However, when I run it in MS Query (via Excel) I get an error.
The specific line that it throws an error on is:
( CASE glfeeddetail.entrytype WHEN 1 THEN GLFEEDDETAIL.Amount * -1
ELSE GLFEEDDETAIL.Amount
END ) AS GL_Amt,
The error is 'INCORRECT COLUMN EXPRESSION'
I also tried putting the expression in this alternative syntax but I still got the same error:
( CASE WHEN glfeeddetail.entrytype = 1 THEN GLFEEDDETAIL.Amount * -1
ELSE GLFEEDDETAIL.Amount
END ) AS GL_Amt,
FYI, I also tried this as a 'Pass through Query' in MS Access 2010 and I got a slightly different error on the same line stating:
'Syntax Error ( missing operator) in query expression.'
Can anyone shed light as to why I would get this error in MS QUERY when the query runs fine in SSRS? I thought any query that runs in one product would run in the other. Do I need to write a slightly different brand of SQL when I'm in MS QUERY?
Thanks
October 26th, 2012, 02:49 PM
-
you got error because SQL server, MS Access 2010 and MS Query (via Excel) has slightly different syntactic...