• If I see this right, you want to query for a specific month, right?

    If so, why extract dateparts and convert anyway? You could also query for something like this:

    WHERE

     < your date > >= DATEADD(MONTH,DATEDIFF(MONTH,30,GETDATE())-2,30)+1

    AND

     < your date > < DATEADD(MONTH,DATEDIFF(MONTH,30,GETDATE())-1,30) +1

    That example above would query the previous month. You might need to tweak this for your needs. But this way you can use efficient integer operations on datetime columns and indexes could be used, thus performance should be rather good.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]