June 6, 2005 at 9:26 pm
I need to convert the DateTime from a table. So far have this...
CONVERT(varchar, n.TestDateTime)
There maybe null values so this is returning nothing well I run my script. I know I have to use ISNULL but are unsure as to where on this line of code to place it.
Any help would be greatly appreciated.
June 6, 2005 at 9:59 pm
hi
Select
CONVERT(varchar(12), isnull(n.TestDateTime,''),103) from Table
Regards
padmakumar
June 7, 2005 at 8:52 am
I get '1/1/1900' for null dates using that suggestion. I think this does the trick.
declare @testdate datetime
set @testdate = getdate()
Select Isnull(CONVERT(varchar(12), @TestDate,101),'') as MyDate
set @testdate = null
Select Isnull(CONVERT(varchar(12), @TestDate,101),'') as MyDate
MyDate
------------
06/07/2005
(1 row(s) affected)
MyDate
------------
(1 row(s) affected)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply