Re: sql server 2000
- From: "David Portas" <REMOVE_BEFORE_REPLYING_dportas@xxxxxxx>
- Date: Sun, 17 Jul 2005 22:56:41 +0100
For 1 and 3, use date ranges wherever possible so as to avoid complex
expressions and type conversions and to help maximize the benefit of any
indexes. Examples:
One day:
SELECT *
FROM YourTable
WHERE date_col >= '20050717'
AND date_col < '20050718'
One month:
SELECT *
FROM YourTable
WHERE date_col >= '20050701'
AND date_col < '20050801'
For 2 and 4, take a look at the DATEPART function in Books Online.
--
David Portas
SQL Server MVP
--
.
- References:
- sql server 2000
- From: Wendy Elizabeth
- sql server 2000
- Prev by Date: Re: filtering data
- Next by Date: RE: N prefex in a non-unicode database
- Previous by thread: Re: sql server 2000
- Next by thread: N prefex in a non-unicode database
- Index(es):