you want to use:
CREATE PROCEDURE …
@StartDate = ‘1/1/2000’
not
CREATE PROCEDURE …
@StartDate = NULL
the reason for this is that if you use NULL, you have to put WHERE (@StartDate IS NULL OR DateValue > @StartDate) in your where clause, which screws your query optimization. if you default to an old date, you can just put WHERE (DateValue > @StartDate) so the optimizer will be happy—
Friday, December 5, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment