All Forums Third Party Software
devylzangel 1 post Joined 07/12
15 Oct 2012
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?
 
 

Fred 1096 posts Joined 08/04
01 Dec 2012

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')
You must sign in to leave a comment.