EntityDataSource date parameters with Teradata

Third Party Software

EntityDataSource date parameters with Teradata

I am working on a web application in .NET Framework 4 (C#).  We are using the Entity Framework (v4) with a Teradata backend.  I am trying to set the where clause for an EntityDataSource so that a date column is equal to a specific value:

.where = string.Format(@"it.Begin_Date = CAST('{0}' as date)", Convert.ToDateTime(txtSelectedBeginDate.Text).ToString());

This is throwing the following error: [Teradata Database] [5407] Invalid operation on an ANSI Datetime or Interval value.

I've tried alot of different variations of formatting the date and have received a multitude of error messages for my efforts.

Can anyone tell me the correct way to do this?

Teradata Employee

Re: EntityDataSource date parameters with Teradata

A Teradata DATE literal has the keyword DATE followed by a 10-character string enclosed in apostrophes(single quotes), like

DATE '2012-11-30'

Or you can supply a character literal in some other form and CAST it to a DATE using an explicit FORMAT

CAST('11/30/2012' AS DATE FORMAT 'mm/dd/yyyy')