Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

UNION Query - text and date time formatting issue

$
0
0

Hi

I have a union query where the column is not available in the first data set, but is on the second.  The second data type is datetime.  The scripts run perfectly individually, but when I union, I get the date and time converted to  date1900-01-01 00:00:00.000 time: 1900-01-01 00:00:00.000

I have the following code:

SELECT '' myDATE
  , '' myTIME
FROM
 table1
UNION ALL
SELECT myDATE
  , myTIME
FROM
 table2

Can anyone help with this to allow the date and time to be formatted correctly?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>