Rikin
Rikin

Reputation: 275

Dummy DATE field with NULL value

I am performing a union between two tables. In order to make the two tables consistent for a UNION, I need to add a dummy column.

One table has DATE field whereas the other table does not have that field. How can I create the dummy DATE field which can either be '' (blank) or NULL?

I am trying something like this in DB2

TO_DATE('','MM/DD/YYYY') AS DUMMY_DATE

Upvotes: 0

Views: 4179

Answers (2)

Giorgi Nakeuri
Giorgi Nakeuri

Reputation: 35790

Just use NULL as column:

NULL as Dummy

Upvotes: 0

Vamsi Prabhala
Vamsi Prabhala

Reputation: 49260

Just select null.

select col1, datecol from table1
union all
select col1, null from table2

Upvotes: 2

Related Questions