Sunday, 7 May 2017

5 Top Teradata DATE functions read now

Teradata DATE functions
Teradata Functions
The following are the list of DATE functions. These are very frequently being used in Teradata.

Current DATE

The following statement requests the current system date:
SELECT CURRENT_DATE; The system responds with something like the following:
Date -------- 01/12/28

Changing Current DATE to DATE as you expected

To change the default output format of the CURRENT_DATE result, use Teradata explicit conversion syntax and specify the FORMAT phrase. For example, the following statement requests the current time and specifies a format that is different from the default:

SELECT CURRENT_DATE (FORMAT 'MMMBDD,BYYYY');
The result looks like this: Date ------------ May 31, 2007

Current Time

The following statement requests the current system time and current session Time Zone displacement:

SELECT CURRENT_TIME; The system responds with something like the following:
Current Time(0) --------------- 15:53:34+00:00

Changing Current TIME

To change the default output format of the CURRENT_TIME result, use Teradata explicit conversion syntax and specify the FORMAT phrase.

For example, the following statement requests the current time and specifies a format that is different from the default:

SELECT CURRENT_TIME (FORMAT 'HH:MIBT');
The result looks like this: Current Time(0) --------------- 02:29 PM

Also Read: 3 Books to read by every Software Engineer

Current TIMESTAMP

CURRENT_TIMESTAMP Fields The fields in CURRENT_TIMESTAMP are:
• YEAR
• MONTH
• DAY
• HOUR
 • MINUTE
• SECOND
 • TIMEZONE_HOUR
• TIMEZONE_MINUTE

Example to Select Current TIMESTAMP

The following statement requests the system timestamp and session Time Zone displacement: SELECT CURRENT_TIMESTAMP;

The system responds with something like the following: Current TimeStamp(6) -------------------------------- 2001-11-27 15:53:34.910000+00:00

Example to ADD_MONTHS

This statement returns the current date plus 13 years.

SELECT ADD_MONTHS (CURRENT_DATE, 12*13);

Example to Extract Year from DATE

The following example returns the year, as an integer, from the current date.
SELECT EXTRACT (YEAR FROM CURRENT_DATE);

Thursday, 3 November 2016

Teradata Quick refresher for most popular Utilities

Teradata Popular utilities
Teradata Popular Utilities
Teradata utilities are very important while working with SQL and in data warehousing projects. The below short and crispy definitions help you can use while attending for interviews or in your day to day work to refresh your Teradata knowledge.

MultiLoad -
Inserts, updates, deletes, or upserts rows in a Teradata table by using the MLOAD command-line utility. It can handle multiple SQL statements in a single operation. You can provide user-defined SQL for complex operations. This stage is best used for bulk updates, deletes, upserts, and complex interface operations.
 
TPump - Inserts, updates, deletes, or upserts rows in a Teradata table using the TPUMP command-line utility. It can do concurrent updates on the same table. It can handle multiple SQL statements in a single operation. You can provide user-defined SQL for complex operations. 

FastExport -
Exports data from a Teradata table by using the FEXP command-line utility. You can customize it to use user-defined SQL statements for extraction. This stage is best used for bulk extracts from Teradata.