If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Teradata - Converting Date Format Q

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-04, 12:58
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
Teradata - Converting Date Format Q

Hi All.
I need a way to execute a select statement where values are being passed dynamically from an ASP page. Everything is fine if I execute a query like this...

SELECT * FROM TableName
WHERE Col1 = '12-1-2003'
AND Col2 = '234';

The problem is the format of the date (which is dynamically generated from a 3rd party calendar app) is pumped into the field in mm/dd/yyyy format.
If left like this, Teradata gives me an error:

<snip>
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E57)
[NCR][Teradata RDBMS] A character string failed conversion to a numeric value.
</snip>

Which is because of the improperly formatted date. Is there a way I can convert this to the proper format within the SQL statement. The dynamically built statement looks like this:

SQL = SQL & "TableName = '" & Request.Form("date") & "' " _
& "order by Column1 "

Thank you.
Reply With Quote
  #2 (permalink)  
Old 06-15-04, 18:22
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,613
The simple solution would be to write a function or expression that will reformat the date for you "on the fly" into the ISO format used by Terradata.

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On