Viewing 10 posts - 346 through 355 (of 355 total)
I've been thinking about this problem over the weekend, and I reckon I've come up with an extension of the method proposed by rbarryyoung that reliably returns the nearest point...
November 30, 2008 at 5:08 pm
Good catch. But that leaves me wondering how it converts the results from Great Circle Radians to Miles?
It's not converting from great circle radians to miles - it doesn't...
November 28, 2008 at 11:24 am
Well, I snatched them from a post at the site that Chris Morris linked too (had to fix a bug in it though), which had no real explanation of it,...
November 28, 2008 at 10:24 am
Try this:
-- based on 1/1/1900 = 0 is a Monday
PRINT GETDATE()
PRINT 'Next occurance of Monday: '
PRINT DATEADD(day, DATEDIFF(day,0,GETDATE()-1)/7*7+7, 0) -- use 1/1/1900 = 0 is a Monday
PRINT 'Next occurance of...
November 24, 2008 at 10:09 am
SELECT DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '19000101') AS followingMonday,
DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE())...
November 24, 2008 at 8:20 am
SELECT DATEADD(wk,DATEDIFF(wk, 0, getdate()), 6)
Yes, this works well for Sundays, but it is not as straightforward as you would hope to generalise it to work for other days of the...
November 24, 2008 at 8:04 am
Or more generally, if @weekday represents the weekday that you want to retrieve, where Monday = 1, Tuesday = 2, ..., Sunday = 7, then the following expressions will do...
November 21, 2008 at 1:46 pm
The following returns the date that is the next Sunday. If today is Sunday, it returns today.
SELECT DATEADD(day, (15 - DATEPART(dw, GETDATE()) - @@DATEFIRST) % 7, GETDATE())
The following returns the...
November 21, 2008 at 1:13 pm
select getdate() + 7 - Datepart(dw, getdate())
This only works if @@DATEFIRST = 1 (Monday)
An expression that returns the date of the Sunday in the current week regardless of...
November 21, 2008 at 11:30 am
This is one of those situations where using a cursor is the more natural approach and will probably be more efficient than any possible single query approach.
The following query that...
November 21, 2008 at 10:21 am
Viewing 10 posts - 346 through 355 (of 355 total)