February 1, 2013 at 8:02 am
hi,
I have a query as below
select ISNULL([HIRE_VEHICLE_REGISTERED_DATE],'') from WIP_INVOICE_HEADER
This returns the output as 1900-01-01. But i need an empty string if the value in the column is null.
how can i get that?
Please help....
February 1, 2013 at 8:05 am
You will need to convert the column to a string.
If you tell SQL to use '' as a datetime column you will get 1900-01-01 as that is the default date and the default way SQL works.
February 1, 2013 at 8:17 am
Hi
If you see my entire sql it will be a coalesce of many columns. In that one is a datecolumn and i do the following
COALESCE(CAST(ISNULL(IH.[HIRE_VEHICLE_REGISTERED_DATE],'')AS VARCHAR) + ',', '')
When i do export,
Only empty values were comma sepearted and null values are not.
so i do a null check and to replace all null values with empty string.
February 1, 2013 at 8:19 am
Convert the column before doing the ISNULL check
ISNULL(CONVERT(varchar, datecolumn),'')
February 1, 2013 at 8:27 am
Thanks it worked
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy