Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Find alternate week day

Jan 12 2010 9:45PM by Madhivanan   

My co-worker had a task of finding minimum alternate week day as of today for a given date and day. Consider these data

  • Date : 2009-12-22
  • day : 5 (it denotes Thursday)

It means the event was scheduled on 2009-12-22 which should run on every alternate Thursday starting from 2009-12-24 (The first Thursday on or after the scheduled date). The task is finding the minimum of current available day Here is my solution

declare @date datetime, @day int 
select @date='2009-12-22',@day=5

select 
        min(dateadd(day,14*(number),date)) 
from 
        (
                select dateadd(day,@day-datepart(weekday,@date),@date) as date
        ) as t,master..spt_values
where type='p' and dateadd(day,14*(number),date)>=getdate()

Tags: t-sql, sql_server, week-day,


Madhivanan
2 · 40% · 13039
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Find alternate week day" rated 5 out of 5 by 1 readers
Find alternate week day , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]