0 - 45 of 45 tags for date


I am a new developer in Teradata world and I'm having to take the quotes from a variable to a software returns me.


I have that: a12.Calendar_Dt in (DATE '11/26/2013')


I can manipulate the start and the end of the variable but not the center.

Here is my insert statement.


SELECT MAX(CAST (click_dt AS DATE FORMAT 'yyyy/mm/dd') ) FROM B;


I get and empty table even though the answer to below query is 5/25/2015

I have bteq .RUN command sandwiched by .OS calls which log the start and end date times of the .RUN. The dates are gotten by calls to UNIX 'date' command. The START date is fine, however, my COMPLETED date is always equal to my START date. I don't see how that's possible because the 'date' command is invoked fresh on the COMPLETED line.

I am trying to write a macro because I need to run this monthly. I have to run this monthly for different groups of potential, which I want to pass by parameters.
In the past, I used the current_date, and it worked, but now I would like to pass the data as a parameter and use that one, but that doesn't work:

While exporting data from Teradata table with MLSCRIPT option to generate mload script too. I am getting below strings p1<96> or p1 instead of DATE/TIME/TIMESTAMP fields in layout section.
p1<96>p1<96>.FIELD COLUMN2 * CHAR(1);

Good Morning All,
I've just changed roles. I've got about 4 years experience with MS SQL Server (T-SQL) and my new role uses Teradata.

I was suggested by DBA to change in one of tables , the partitioning column from timestamp to date.
In explain plan I can see that in both cases partition prunning takes place.
Is there anybody that is master in partitioning in teradata and can help if there is some logical reasoning for such change ?

Hi all,
I created a table 

create table financial.test

 (empid integer not null, 

 ename char(30), 

hiredate DATE FORMAT 'ddmmyyyy' )

primary index (empid);


and inserted data into it and the data is as fallows


empid ename hiredate

1 101 abc 01-01-2000

Hello everyone,
 I need to get the week of the year from a date, but 1st of Jan being the 1st week. (no matter what day it falls on). How can I get this in Teradata sql? For eg. 6 Jan 2013 is week 2.  Can someone please help?
Thank you so much.




I am new to Teradata and I am working on query for which I greatly appreciate any help.


i have data in a table as shown below:












Our Teradata instances are used as a DW for our DB2 mainframe application.  In those DW tables, NULL values for date fields are instead represented by '1111-11-11'.  I figure this was either done intentionally as part of the design (either mainframe or DW-side) or it was out of necessity due to NULL not being allowed in a DATE field.

Hi All,
Given the following data sorted by Name and Date:
Name      Status      Date
Bob        A           2013-08-01
Bob        A           2013-08-04
Bob        C           2013-09-13
Sally       A           2013-04-17
Sally       C           2013-06-07
Sally       C           2013-07-09

I'm using this MLOAD script:






    VALUES ( :FIELD1 ) ;

     I need to filter only those records in a partition that have overlapping dates. Consider the following scenario,
1 123 1/1/2013 9/8/2013
2 123 9/1/2013 9/8/2013
3 123 9/9/2013 10/8/2013
4 245 1/1/2013 9/8/2013
5 245 9/1/2013 9/8/2013
6 245 9/9/2013 10/8/2013

Hi all

First post. Apologies in advance if this question has been asked to death before and/ or if I'm posting this to the wrong section.

Hi all

First post. Apologies in advance if this question has been asked to death before and/ or if I'm posting this to the wrong section.

Good Day All,
This is my first time posting and have looked for help here before, but can't seem to figure out what I need to do.  So I figured I would reach out and ask for assistance pertaining to my query.
I need to run a query that allows me to pull out data that has the most current date.  Below is the query I am using:

I am pretty new to teradata and know some basic SQL but I find that I am struggling with this problem.

Hi All,
I have a date "Mar 1 2013" which i want to load it into a table with date format as 'MMMBDDBYYYY' is there any way i can load this without adding a "0" before the 1 in the given date?
i am using TD14.

This is my first post in this forum. I am new to teradata DB. There is a project that I am working on where we are receiving the date in varchar format :

Hi All,
I have a SP like this

I need to load a file using mload where  the load clm has a data like this 03/29/2013 12:00:00 PM.
select cast(cast('03/29/2013 12:00:00 PM' as timestamp(0) format 'MM/DD/YYYYBHH:MI:SSBT') as varchar(22))
I need it to load as Timestamp rather than varchar

My Source data has only two digit year when i am trying to convert to timestamp
sel cast('12/12/12 00:00:00' as timestamp(0) format 'MM/DD/YYBHH:MI:SS')
12/12/1912 00:00:00
tried with the current_timestamp(0)
sel cast(current_timestamp(0) as timestamp(0) format 'MM/DD/YYBHH:MI:SS')

My Source data has only two digit year when i am trying to convert to timestamp
sel cast('12/12/12 00:00:00' as timestamp(0) format 'MM/DD/YYBHH:MI:SS')
12/12/1912 00:00:00
tried with the current_timestamp(0)
sel cast(current_timestamp(0) as timestamp(0) format 'MM/DD/YYBHH:MI:SS')

In my blog entries "Teradata Columnar" and "9.2 Quintillion? What's that all about?", I discussed column partitioning and the increased partition limit that are introduced in TD 14.0.  But there are other TD 14.0 partitioning enhancements that you may find useful.  The following provides a brief introduction to these enhancements; for more detailed information, see the Orange Book: Increased Partition Limit and other Partitioning Enhancements, the Orange Book: Teradata Columnar, and the TD 14.0 manuals.


I currently have an SQL code which determines the most recent time that an item was made serviceable.


What I'm now trying to do is to find the first date in which a notification was raised against that item that occured after the serviceable date, and then count the number of days in between.


For example:

Select EmailAddress, CreatedDate
From _ListSubscribers
Where ListID = 10630 AND CreatedDate > (Select DATEADD (day,-90,getdate()))


I need to convert date, which is in the format 'MM/DD/YYYY', to the target format 'DD-MMM-YY'. I tried the following query and it worked too.


I would like to know if there is any other better way I can get this done.



I'm very much new to Teradata and writting queries as such. I have a CHAR Type column which contains data as follows

'2012-01-20 02:32:37.000000'.


How do I convert this CHAR type data to DATE Type, preferably as a timestamp?




What is the best way to convert 'yyyy-mm-dd' to the Teradata interger storage of a date? (yyyy-1900)mmdd


For example:

If my date was April 1, 2012 and it was stored in the database column in the format 'yyyy-mm-dd'.

This is what I am trying to get: 1120401

What is the Maximum date and minimum date value accepted by Teradata?


In one table of our data warehouse there are 2 columns, "Sceduled Complete Time" and "Actual Complete Time".

Both these columns are in the format of "YYYY/MM/DD HH:MM:SS"

The Viewpoint Portal allows the user to configure their Viewpoint User Profile to display dates in the correct format for any locale and any timezone that is desired. This user profile information is stored on the Viewpoint Server so that all dates can be formatted appropriately either on the server side or on the client side.

Hi, I have a table called Employee with Join Date and Last Date. This table may also contain future employees. Now I want to write a View to list all employees (current and future; but not previous employees). Can anyone suggest me best Date logic to get this information.

I'm adding up totals within a database and would like to see how the totals change over different time periods.

I'm using this code:


Select Sum(CASE WHEN Offer_1 = 'Y' THEN 1 ELSE 0 END) as Offer1,

Sum(CASE WHEN Offer_2 = 'Y' THEN 1 ELSE 0 END) as Offer2,

I'm finding an issue I'm having with a Fastload job and a text file with pretty standard dates extremely maddening, and I am sure V12/V13 has changed Fastload's behaviour in some way, as I'm sure what I am trying to do was not this difficult before.

Consider a few rows of the tab-delimited text file:

Hello, does anyone know of an equivalent for the MSSQL data type DATETIME? I cannot seem to find anything in Teradata documentation that indicates such. Using TIMESTAMP is not an option as it is a HEX type.


Hi I have a select satatement in stored procedure,

Inthe where condition, i have

b.dt2_month_end =( DATE :THIS_END_DATE - EXTRACT(DAY FROM :THIS_END_DATE))--------statement A
i'm getting some syntax error.(I declared :THIS_END_DATE parameter before begin, so i think no prob with parameter)

if i give hard coded values like

My data:
15-MAR-11 AM
15-MAR-11 AM
15-MAR-11 AM
15-MAR-11 AM
15-MAR-11 AM

My current DDL:
CREATE multiset TABLE dbname.dbtable
CREATE_DATE timestamp(6)

My current TPT Insert statement:
'INSERT INTO '||@TargetDatabase||'.dbtable

The data is being stored in the database table with century of '19' instead of '20'. My data will always be century of '20':

1911-03-15 07:54:08

How do you determine the month-end date when building a date dimension?

One of our ETL developers recently pointed out that our date dimension (which I had populated) had incorrect values for month-end date, so I had to find a way to reliably calculate that value.

Hi all,

I'm after some help with converting strings in to dates

For example, when i tried to convert '01.12.2010' in to date format '2010-12-01'. I keep getting error "Invalid date supplied"?

Can anyone suggest a solution?

Many thanks in advance




I'm looking for an efficient way to calculate some windowed aggregates over a table with date-stamped records. A simple table would be organized as:

Acct_Nbr Date Purchase
101 2010-01-05 $32.95
101 2010-01-11 $55.00
102 2010-01-03 $12.50
101 2010-02-10 $10.00
101 2010-02-10 $15.00
101 2010-02-10 $85.33

I need to rollup and report data by week, with the week being defined as Sun through Saturday and identified as the Saturday-date. Does Teradata SQL have any functions that could facilitate this?

These UDFs implement difference determination in months/years using smaller units of granularity, days/months, to accurately calculate the difference.