sql server - SQL output modification: NULL to String -


i using sql retrieve 2 dates. formatted first date convert(varchar(10), date, 110). changes output 12-08-2013 (for example).

now, want second date formatted same way unless = null, in case should come out 00-00-0000.

    select convert(varchar(10), date_opened, 110) opened,       --if date_closed = 'null' return '00-00-0000' closed       --else return convert(varchar(10), date_closed, 110) closed,    

is there way apply specific formatting output? cannot modify underlying database.

select isnull(convert(varchar(10), date_closed, 110), '00-00-0000')  [closed] 

or

select coalesce(convert(varchar(10), date_closed, 110), '00-00-0000')  [closed] 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -