Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 YTD Filter

Author  Topic 

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-10-30 : 17:10:51

Lets get a little compitition going here.

Whats the best and fastest way to build a Year to date Filter?



Jim
Users <> Logic

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-10-30 : 19:55:45
Based on which calendar?
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-10-31 : 05:01:10
How about :

WHERE Datepart(yy, InvoiceDate) = Datepart(yy, GETDATE())

Or did I miss the point entirely?

Owais


Where there's a will, I want to be in it.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-10-31 : 07:13:41
There's always the Arnold Fribble technique:

WHERE TransDate >= DateAdd(yy,DateDiff(yy,0,getdate()),0)



- Jeff
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-10-31 : 07:47:27
quote:
Originally posted by ValterBorges

Based on which calendar?




How About Aztec Valter LOL


So Far Owais runs the fastest with my test data.

Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -