ReadVitamin

Blogging on Teradata SQL and More

14 Comments

mygif
Nirupama Said in Thursday, December 6th, 2007 @6:03 am  

I want to retrieve only the hour part and minute part from the date. Please can u help me in this regard?

mygif
cindy Wang Said in Monday, December 31st, 2007 @6:05 pm  

what is the CASE syntax for
if 2 then two
if 3 then three
else other

mygif
admin Said in Monday, December 31st, 2007 @8:15 pm  

Hi,
Please provide a little more info on your need. A simple CASE statement syntax is as follows
CASE <column-name>
WHEN val 1/Cond 1 THEN result 1
WHEN val 2/Cond 2 THEN result 2
……………………….
……………………….
……………………….
WHEN val n/Cond n THEN result n
[ ELSE default/unknown result ]
END [Column Alias]

mygif
Jasmin Bibi Said in Tuesday, February 19th, 2008 @12:01 pm  

Hi,
I am new to Teradata and I want to show date in following format :

19-Jan-2008

Please tell me using which function i can show the date in the above format.

Thanks and Regards
Jasmin

mygif
admin Said in Tuesday, February 19th, 2008 @5:53 pm  

Hi Jasmin,

You can use the following;

SELECT date(format ‘dd-mmm-yyyy’);

This might not work on SQL Assistant but would work on BTEQ session.

mygif
Jasmin bibi Said in Monday, February 25th, 2008 @10:44 am  

Hi
i am new to Teradta can any one tell me that is ARRAY is there in teradata and also please tell me how to use it in a stored procedure.

Thanks and Regards
Jasmin

mygif
admin Said in Wednesday, February 27th, 2008 @12:12 am  

Hi Jasmin,

I am not sure whether we have arrays in Teradata. But, what is your need, if you can elaborate, may be we can work out something else.

mygif
tanmayi Said in Thursday, March 6th, 2008 @10:55 am  

Hi,

1) I have 5 huge tables with disjoi1nt data columns except the PI and date column.I need to merge the data into one table so that, one row per account(PI) is created with individual data columns from the 5 tables. The accts may or maynot match between the tables. How do I do this without performance issues? LEFT JOIN?

2) I have a one-rowed table which has NUPI of run-date. Some data tables have acct-key as UPI and run-date as PPI.But some data tables have neither acct-key nor run-date columns. I might have to build join across tables-with-columns, tables-without-those-columns and the one-row table to evaluate data in CASE statements. EXPLAIN shows product join and is badly skewed. How can I rewrite this better?
Ex: T1(huge table with columns)
T2(huge table without columns)
SR(single row table)
sel
Sum(case
when T1.t1 = ‘X’ and
SR.code = ‘ ‘ and
T2.t2 = ‘Y’
then ‘GOOD ACCT’
end) as qualified_acct
from
T1, T2, SR
where
T1.acct-key = T2.acct-key and
T1.run-date = SR.run-date;

mygif
admin Said in Thursday, March 6th, 2008 @10:07 pm  

Hi Tanmayi,

For the 1st question, you should use FULL OUTER JOIN instead of LEFT JOIN. As you mentioned you want all the rows( matching and not matching) FULL OUTER JOIN would be more applicable.

I am a bit confused on your 2nd question, when you say T2 does
not have neither acct-key nor run-date columns then how can you join it with acct-key with T1 as under:

T1.acct-key = T2.acct-key and

I guess, I am missing something here, can you please elaborate a bit more.

mygif
punam Said in Thursday, March 13th, 2008 @5:38 am  

Hi,
Can we create and execute macros inside the procedure and how to use this?

Thanks & Regards
Punam

mygif
krisha Said in Wednesday, March 19th, 2008 @8:07 pm  

hi every one,

I am new to teradata. i want to teradata sql pdf’s.

Thanks,
krisha.

mygif
admin Said in Thursday, March 20th, 2008 @11:48 pm  

Hi Krisha,

Welcome to the world of Teradata. Well when you talk about PDFs do you mean to say Teradata Documention PDFs or something else.

For TeraData Documentation you can goto the following site:

http://www.info.teradata.com/

Thanks

mygif
Navnit Said in Friday, May 16th, 2008 @12:36 pm  

you can use this sql for retrieving the hour and time respectively;;

select (extract (hour from current_timestamp(0)) || extract(minute from current_timestamp(0)))

Trackback & Pingback

  1. mentioned about this post in Friday, July 27th, 2007 @9:55 pm  
Leave Your Comments Here

Popular Articles