|
Posted by Erland Sommarskog on 11/26/05 11:33
laurenq uantrell (laurenquantrell@hotmail.com) writes:
> Maybe you're right but it's pretty bullet proof and passing integers
> seems preferable to passing strings.
And binary values are even better. You should not pass dates as strings
to SQL Server. You should pass them as datetime values.
> I imagine this would have implications on query performance as well
> since the stored procedures would be using DECLARE'd variables as WHERE
> filters (WHERE StartDate BETWEEN @ServerStartDate and @ServerEndDate...)
Yes, if these are local variables and not parameters, SQL Server cannot
do parameter sniffing on them, but will apply standard guesses.
One way to circumvent this is to have a wrapper SP which unpacks the
integer values, and then call an inner SP which have datetime parameters.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|