VentureFree
Well-known member
- Joined
- Jan 9, 2008
- Messages
- 54
- Programming Experience
- 5-10
I'm trying to create a DataSet in VB.net which accesses a table in a Sybase database. One of the columns is named Timestamp, and trying to select this column is causing problems due to it's being a reserved word...plus the fact that the datatype is a datetime and not a timestamp. Here's the base select statement:
This causes the following error:
I was told by someone to use quotes around it like "Timestamp", but this selects the literal string "Timestamp". Same thing using single quotes like 'Timestamp'. This doesn't cause any errors in the query itself, but of course it causes problems with anything expecting a datetime from this query.
Someone else told me to change the name of the column in the select by using Timestamp=ThisTimestamp or possibly ThisTimestamp=Timestamp (he wasn't sure which), but both of them cause similar errors.
So how do I select that column given that it's a reserved word? Again, in case it's relevant I'll point out that this in the context of a DataSet in VB.net.
VB.NET:
SELECT AgentLogin, FirstEventTimestamp, Timestamp, EventType
FROM dbo.eAgentLoginStat
I verified that it's the Timestamp itself causing the problem by excluding it which resulted in the proper values being selected (i.e. AgentLogin, FirstEventTimestamp, and EventType). Coming from a Sql Server background, I tried [Timestamp] next, but that caused this error:Error in SELECT clause: expression near ','.
Missing FROM clause.
Unable to parse query text.
Error in SELECT clause: expression near '['.
Missing FROM clause.
Unable to parse query text.
I was told by someone to use quotes around it like "Timestamp", but this selects the literal string "Timestamp". Same thing using single quotes like 'Timestamp'. This doesn't cause any errors in the query itself, but of course it causes problems with anything expecting a datetime from this query.
Someone else told me to change the name of the column in the select by using Timestamp=ThisTimestamp or possibly ThisTimestamp=Timestamp (he wasn't sure which), but both of them cause similar errors.
And again, coming from Sql Server I tried using Timestamp AS ThisTimestamp.-- When using Timestamp=ThisTimestamp
Error in SELECT clause: expression near '='.
Missing FROM clause.
Unable to parse query text.
-- When using ThisTimestamp=Timestamp
Error in SELECT clause: expression near '='.
Missing FROM clause.
Error in SELECT clause: expression near ','.
Unable to parse query text.
Error in SELECT clause: expression near 'AS'.
Missing FROM clause.
Unable to parse query text.
So how do I select that column given that it's a reserved word? Again, in case it's relevant I'll point out that this in the context of a DataSet in VB.net.