Reply to Passing DateDiff rather than Actual Dates as Parameters

Your name:

Reply:


Posted by laurenq uantrell on 11/29/05 05:32

I've gotten sort of fed up with dealing with regional date settings on
the client side and am considering the following scheme - just
wondering if anyone has a negative view of it or not:

Instead of

@StartDate datetime,
@EndDate datetime

Use:

@StartDaysDiff int,
@EndDaysDiff int


In the front end app take the desired date and do a DATEDIFF with the
current date, then pass the date diff as a parameter as an integer
rather than deal with the dates at all.

Then...

DECLARE @TodayDate datetime, @StartDate datetime, @EndDate datetime

SELECT @TodayDate = GETDATE()
SELECT @StartDate = DATEDIFF(DAY,@StartDaysDiff,@TodayDate)
SELECT @EndDate = DATEDIFF(DAY,@EndDaysDiff,@TodayDate)

SELECT
a.Something
FROM
dbo.Appointments a
WHERE
a.AppointmentDate BETWEEN @StartDate and @EndDate

Just wondering ...

Thanks,
lq

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация