Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Teradata support literals for DATE and TIMESTAMP?

Tags:

teradata

I'd like to be able to do something like this:

insert into mydb.mytable (updatetimestamp) values (#1/15/2012 01:03:00#)

...or...

select * from mydb.mytable where updatetimestamp = #1/15/2012 01:03:00#

Using literals wouldn't required the longwindedness of casting and whatnot since it would immediately interpret the expression as a DATE or TIMESTAMP.

Does Teradata support this type of syntax?

like image 350
oscilatingcretin Avatar asked Nov 30 '12 19:11

oscilatingcretin


People also ask

What is the date format in Teradata?

By default, For ANSI dates, Teradata follows the date format as YYYY-MM-DD, whereas for the integer dates, the default date format is YY/MM/DD.

How is date stored in Teradata?

The Teradata RDBMS stores the date in YYYMMDD format on disk. The YYY is an offset value from the base year of 1900. The MM is the month value from 1 to 12 and the DD is the day of the month. Using this format, the database can currently work with dates beyond the year 3000.


1 Answers

Yes, Teradata supports the ANSI format for dates and timestamps. Reference: http://www.teradataforum.com/l070316a.htm

For example:

INSERT 
  INTO  mydb.mytable (updatetimestamp) 
VALUES (TIMESTAMP '2012-01-15 01:03:00');

Or:

SELECT * 
  FROM mydb.mytable 
 WHERE updatedate = DATE '2012-01-15';
like image 151
mechanical_meat Avatar answered Oct 20 '22 00:10

mechanical_meat