Convert Null to Date

Hi,
  I have a union Query in DB2 database.The upper select of the union has a date field which returns the date.The lower select doesn't have this date field and hence, should be left blank.now, when i put it as Null, it is throwing an error.

 how to deal with this? Please help.
 
pvsbandiAsked:
Who is Participating?
 
momi_sabagConnect With a Mentor Commented:
you just need to convert the null to a date column, for example

select current date col1 from sysibm.sysdummy1
union all
select cast(null as date) from sysibm.sysdummy1
0
 
pvsbandiAuthor Commented:
Excellent, as always!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.