When using UNION I receive "Cannot convert '' to a timestamp" when I try to run something like this:

select [field1], [field2] from [table]


select [field1], '' from [second table];

Field1 is the same in both tables. In the first select statement field2 data type is timestamp but I don't want field2 pulled from the second select statement. Is there a way to cast or format field2 in the second statement to run in this instance?

Appreciate any assistance.

asked 01 Jun '11, 15:32

zippidydo's gravatar image

accept rate: 0%

Try NULL instead of ''.

permanent link

answered 01 Jun '11, 15:36

John%20Smirnios's gravatar image

John Smirnios
accept rate: 37%

Great. That did the trick. Much appreciated.

(01 Jun '11, 16:17) zippidydo
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 01 Jun '11, 15:32

question was seen: 1,762 times

last updated: 01 Jun '11, 16:17