select
data1,
data2,
cast((datefield (format 'YYYYMM')) as char(6)) as YearMonth
from
sourcetbl;
Note: The cast to char(6) is only required if you are retrieving data via ODBC (if omitted it just comes across as the date field unchanged since it is converted into ODBC datatypes and the format is ignored)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.