Exporting SQL Query results to Excel (Dates)
IanP
Posts: 2 New member
in SQL Prompt
Hi there,
I am new here so please forgive me if I am posting in the wrong place.
I have a SQL query that returns some dates depending on a number in another column. If the number is zero then I want it to return 1900-01-01, which we use in our systems as a NULL date.
The query returns the date as 1900-01-01, but if I highlight the results grid and Open in Excel these dates appear in the spreadsheet as a STRING.
The SQL I am using is as follow:-
I am new here so please forgive me if I am posting in the wrong place.
I have a SQL query that returns some dates depending on a number in another column. If the number is zero then I want it to return 1900-01-01, which we use in our systems as a NULL date.
The query returns the date as 1900-01-01, but if I highlight the results grid and Open in Excel these dates appear in the spreadsheet as a STRING.
The SQL I am using is as follow:-
CONVERT(DATE, CASE
WHEN ISNULL(m.mrpldays, 0) = 0 THEN 0
ELSE m.mrpltdate
END) AS [Reschedule Date],
Can anyone throw any light on it?
Can anyone throw any light on it?
Tagged:
Answers
Seem to be getting the same issue here just going to speak to the development team on this one.
It is still on the teams list.