I have a table with two values:
ciid, businessdate
ciid is the primary key, and has auto increment turned on. businessdate (datetime) is inserted by another process.
given the following queries:
select top(1) ciid, businessdate
from checkitemsales
where businessdate='10/9/16 00:00:00:000'
This only takes 1.2 seconds to return, whereas this query:
declare @var1 datetime
set @var1='10/9/16 00:00:00:000'
select top(1) ciid, businessdate
from checkitemsales
where businessdate = @var1
takes over 5.6 seconds to return.
can anyone tell me what I'm doing wrong?