>I know I have this one somewhere in my code but I can't find it. Basically, the goal consists of doing a query and have a condition which implies a calculation on two fields. For example, I need to get all the records where AddDate+NumberOfDay would be less than today.
You can have a computed field in your table (and add an index on this field).
Field's definition will be
dateadd(day, NumberOfDays, AddDate)
Then, using this new field, you can write queries such as
declare @Today date
set @Today = cast(getdate() as date)
select * from myTable where FutureDate < @Today
If it's not broken, fix it until it is.
My Blog