November 29, 2013 at 5:00 am
dd
November 29, 2013 at 5:03 am
Minnu (11/29/2013)
Hi Team,DECLARE @TEMP VARCHAR(100),
@DATETIME DATETIME
SET @TEMP = NULL
SET @DATETIME = CONVERT(DATETIME,ISNULL(@TEMP,'-'))
PRINT @DATETIME
Please help
What are you trying to achieve? Currently, you're trying to convert the char value "-" into a datetime, which obviously fails.
November 29, 2013 at 5:16 am
Hi,
Gettting below error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
is there any method to convert '-' to datetime,
in my scenario, if @temp is null, then '-' should be convert to datetime.
Please suggest
November 29, 2013 at 9:01 am
Minnu (11/29/2013)
Hi,Gettting below error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
is there any method to convert '-' to datetime,
in my scenario, if @temp is null, then '-' should be convert to datetime.
Please suggest
How would "-" be a datetime data type? Where is the year, month, day etc ?
My assumption is that what you are doing is attempting to display this in a front end application or in SSRS, would that be correct? I'd suggest that you handle the NULL value in the presentation layer rather than in the database.
November 29, 2013 at 11:41 am
Minnu (11/29/2013)
dd
How rude. It's just totally improper to delete the original post even if things don't work out exactly as you planned.
If you still need an answer on this, please restore the original question.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply