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 |
|
stexocaster
Starting Member
3 Posts |
Posted - 2011-04-09 : 14:40:29
|
| hello guys i'm really new to this things but i got a offer to create some sql databases and i need some help...i have a table of dates that are common holidays and one column is holiday date..now i wrote a few codes that uses the current date stamp and adds to it 14 days from now...and if that date is Saturday or Sunday it skips it till next workday.Now the problem is i need to create a code that checks if that date is holiday (from table) and if its a date from that column it adds +1 day.Can someone give me the instructions how to do that...I'm using SQL server 2008 by the way. Thanks |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-09 : 16:12:34
|
| What doe the code you have look like at the oment? Is it a loop?select @d = covert(varchar(8),dateadd(dd,14,getdate))while datename(dw,@d) in (Saturday','Sunday') or exists (select * from HolidayTbl where date = @d)select @d=@d + 1It can be done without a loop but depends on what you have to add the code to.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
stexocaster
Starting Member
3 Posts |
Posted - 2011-04-09 : 16:51:52
|
| thx mate very much ill try it :D |
 |
|
|
stexocaster
Starting Member
3 Posts |
Posted - 2011-04-09 : 17:15:12
|
| hey it works thanks i appreciate your help :D |
 |
|
|
|
|
|