December 17, 2010 at 10:55 am
Declare @strStartTime varchar(50)
select @strStartTime = '12/10/2010'
select * from Elect_SubB1_Daily B1
Where B1.Date_Stamp>= convert(datetime,''' + @strStartTime+ ''', 101)
/* =======================================
Getting this error when executed :
Msg 241, Level 16, State 1, Line 5
Msg 241, Level 16, State 1, Line 5
Conversion failed when converting date and/or time from character string.
??
December 17, 2010 at 11:03 am
Declare @strStartTime varchar(50)
select @strStartTime = '12/10/2010'
SELECT CAST(@strStartTime as datetime)
December 17, 2010 at 11:04 am
Pops sorry!! I fixed it. I did not need to use the '+' in the query
This works..
Declare @strStartTime varchar(50)
select @strStartTime = '12/10/2010'
select * from Elect_SubB1_Daily B1
Where B1.Date_Stamp>= convert(datetime, @strStartTime , 101)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply