-2

I have a table which I'd like to convert Null Date (my date format i.e 2014-02-12) to blank string but an error occurs whenever I do IsNull, I have mysql. Is there away to do it with isnull?

Lewis
  • 789
  • 8
  • 20
  • Do you have a code sample, and what is the data type of the field? Also, are you talking about converting the *output* of a query, or the data in the field itself? – Andrew Barber May 13 '14 at 15:36

2 Answers2

2

Try this:

SELECT ISNULL(CONVERT(VARCHAR, date_field), '')
FROM table_name
Isaac Kleinman
  • 3,994
  • 3
  • 31
  • 35
1

MySQL:

 SELECT ISNULL(CAST(date_value AS char),'')

or

 SELECT ISNULL(DATE_FORMAT(date_value , '%d %m %Y'),'')

SQL SERVER:

 SELECT ISNULL(CAST(date_value AS VARCHAR(20)),'')
T McKeown
  • 12,971
  • 1
  • 25
  • 32