SQL Server 2008 R2 - Reporting Services - Windows Server 2003 sp2
I am using BETWEEN in my WHERE clause as part of a VB expression, to power a SSRS report:
(" & Format(Parameters!parm_DateFrom.Value,"yyyy-MM-dd hh:mm:ss") & ") Timestamp(0)
(" & Format(Parameters!parm_DateTo.Value,"yyyy-MM-dd hh:mm:ss") Timestamp(0) "
BUT this is failing with: "Invalid operation for DateTime or Interval."
However, this query works if I replace the WHERE clause with
(CURRENT_DATE-14) AND (CURRENT_DATE)..."
Can anyone shed any light on Teradata comparisons regarding Datetime and Date, etc. Coming from a SQL Server background, it is easy to compare Timestamp with Data values and vice-versa.
A Teradata/ANSI timestamp literal is preceded by keyword TIMESTAMP and enclosed in apostrophes / single quotes:
TIMESTAMP '2012-11-30 12:34:56'
Or you can cast a character literal to TIMESTAMP(0), in either TD or TD format:
'2012-11-30 12:34:56' (TIMESTAMP(0))
CAST('2012-11-30 12:34:56' AS TIMESTAMP(0))
But your example generates invalid syntax like
(2012-11-30 12:34:56) TIMESTAMP(0)
School-boy error, thank-you for spotting this. Working with VB expressions makes me overlook single/double quotes.