-3

When I use cache sql query in C# I'm getting an error:

SQLtext1 = "SELECT top 10 * FROM dbo.DAPPLICATIONSTAT where TIMESTAMP = '2015-02-01 00:00:00'"

I would like to use a where clause with a datetime filter.

I am using InterSystems.Data.CacheClient.dll to execute the query.

Error Messge :

[SQLCODE: <-4>:<A term expected, beginning with one of the following: identifier, constant, aggregate, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, %UPPER, $$, :, +, -, (, NOT, EXISTS, or FOR>] 
[Cache Error: <<SYNTAX>errdone+2^%qaqqt>] [Details: <Prepare>] 
[%msg: < SQL ERROR #4: A term expected, beginning with either of: (, NOT, EXISTS, or FOR^SELECT top :%qpar(1) * FROM dbo . DAPPLICATIONSTAT where TIMESTAMP>
Irina Avram
  • 1,492
  • 2
  • 20
  • 35
Ezhil
  • 1

1 Answers1

1

I think that you have reserved word TIMESTAMP and so, you have that error
Try this SQL query, where filedname TIMESTAMP in dobled quotas

SELECT top 10 * FROM dbo.DAPPLICATIONSTAT where "TIMESTAMP" = '2015-02-01 00:00:00'
DAiMor
  • 3,185
  • 16
  • 24