sql - Converting a Date Format to YYYYMM in Cognos Report Studio -


i have date column in format 12 may, 2014 want convert yyyymm/ 201405 format. tried multiple options

extract(year, sys_date)*100 + extract(month, sys_date))*100 cast(extract( year, sys_date), varchar(4)) + cast(extract( month, sys_date), varchar(2)) 

this 1 works returns me in yyy,ymm format.

cast(to_char(sys_date, 'yyyymm'), int ) 

for above two, gives error:

 error occurred while performing operation 'sqlopenresult' status='-28' 

can 1 please guide. thank in advance.

i got looking for. did:

translate(cast(to_char(sys_date, 'yyyymm'), varchar(6) ), ',' , ' ') 

i sure there better way result use sql gives me want :)


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -