Search This Blog

Wednesday, March 17, 2010

How to display Date in 'YY-MM-dd' format in Sql Assistant

creating table:
create table tab6(col1 integer,col2 date);

populate table as :
ins tab6(1,DATE);
ins tab6(2,DATE);
ins tab6(3,DATE);

In Bteq :

select col2 (format 'yy-mm-dd') from tab6;


*** Query completed. 3 rows found. One column returned.
*** Total elapsed time was 1 second.
col2
--------
08-09-14
08-09-14
08-09-14

But this won't work in SQL ASST

In SQl ASST :
we need to specify the following query

select cast( (col2 (format 'YY-MM-DD')) as char(10)) from tab6;

This is because SQL Assistant is connected to Teradata via ODBC and BTEQ uses CLI.
And ODBC doesnot support FORMAT clause.
This is why the results are different in SQL Assistant and BTEQ.

No comments:

Post a Comment