I am having a problem running a query that uses a datetime variable in the where clause in a sp.
Here is a cut of the code I am having a problem with.
________________________________________________________
Declare @StartTime as datetime
Declare @strsql as char(200)
Set @Starttime = '05:52:00 AM'
Set @Starttime = dateadd(Minute,8,@StartTime) /* I am using 8 minute intervals starting at 5:52 */
Set @strsql = "insert into mastertemp select Date, Time, App from [TempHold] where Time = " + @endtime
_________________________________________________________
I have tried using % to no avail.
I keep on receiving this error
Syntax error converting datetime from character string.
Which makes no sense because @endtime is datetime.
What should I do to correct this error?
Thank You all!
Log
Here is a cut of the code I am having a problem with.
________________________________________________________
Declare @StartTime as datetime
Declare @strsql as char(200)
Set @Starttime = '05:52:00 AM'
Set @Starttime = dateadd(Minute,8,@StartTime) /* I am using 8 minute intervals starting at 5:52 */
Set @strsql = "insert into mastertemp select Date, Time, App from [TempHold] where Time = " + @endtime
_________________________________________________________
I have tried using % to no avail.
I keep on receiving this error
Syntax error converting datetime from character string.
Which makes no sense because @endtime is datetime.
What should I do to correct this error?
Thank You all!
Log