SQL Reserved word error

emorris1000

Registered User.
Local time
Today, 12:28
Joined
Feb 22, 2011
Messages
125
Getting the "This Select statement includes a reserved word or argument name that is mispelled or missing" error on a table, I think I know what is causing it but wanted to be sure.

The following works

Code:
Select  PolyID, Ethflow, "" as H2RatGC, ""as C6RatGC
From Trundata
Where PolyID = "UT-00409-024"
Union
Select  PolyID, "" as Ethflow,  H2RatGC, C6RatGC
From [GC Data]
Where PolyID = "UT-00409-024"

However this throws an error:

Code:
Select  PolyID, Time, Ethflow, "" as H2RatGC, ""as C6RatGC
From Trundata
Where PolyID = "UT-00409-024"
Union
Select  PolyID, RunTime as Time, "" as Ethflow,  H2RatGC, C6RatGC
From [GC Data]
Where PolyID = "UT-00409-024"

My guess is that "Time" is the reserved word. If so I am a bit surprised because it exists in a bunch of other queries.
 
Yes, TIME is a reserved word. You can get it to work for yourself though if you put square brackets around it:

SELECT PolyID, [Time], EthFlow...etc.


But best to not use reserved words.
 
Yeah, it's on my list of things to do in cleanup mode. Got it working now thx!
 

Users who are viewing this thread

Back
Top Bottom