Saturday, November 13, 2010

how to cast date in MMYYYY format in SQL Teradata

how to cast date in YYYYMM format using SQL in Teradata

For odbc connections (e.g if you are using sql assistant/queryman) then use:
sel cast((current_Date (format 'yyyymmdd' )) as char(8));

For native connections (e.g if you are using bteq) then use:
sel current_date (format 'yyyymmdd');

however you may use below query(same as for sql assistant) in bteq also ...
sel cast((current_Date (format 'yyyymmdd' )) as char(8));

This is how you can cast date in different formats in sql teradata. Simple :-)


Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | fantastic sams coupons