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.
Author |
Topic |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-10-22 : 06:05:57
|
Hi,How do I get the previous working date?for example todays date is 22/10/2007I would like to get 19/10/2007 i.e. last friday |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-10-22 : 06:35:26
|
while datename(dw,@dte) in ('Saturday', 'Sunday')select @dte = @dte - 1Can do it in a single statement but this is simplest.What about bank holidays?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-22 : 09:09:07
|
What about holidays?Or you just meant "previous weekday" (a monday to friday value)? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|