Solved

create SQL Calendar

Posted on 2008-10-21
3
215 Views
Last Modified: 2011-10-19
Hi

I need some help.

I am using SQL 2005, and I have a calendar created, attach is an example of how my calendar looks.

What I would like to go is create a script that would update the table BTItem that has a field name 'DATE'
which would have a numeric value e.g.  1 = Sunday,  2 = Monday....etc...so the script would add 1 to the date field.

But here is the catch, I only want the script to run on working days.
Weekends and holidays I DO NOT want it to update the table BTItem.

What is the SQL code for this ???

I am at a lost.
Time.xls
0
Comment
Question by:jamesb_007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
adlink_la earned 500 total points
ID: 22767657
How about having your script query your calendar table for DayNoWeek where DateGregorian = CONVERT(VARCHAR, GETDATE(), 101).  Then only let it run if DayNoWeek is between 2 and 6.
0
 
LVL 5

Expert Comment

by:adlink_la
ID: 22767720
As for the holidays, you will need to add a column to your calendar table to put them in or create another table that you can join to, to get them.  A seperate table would probably be easier to manage.
0
 

Author Comment

by:jamesb_007
ID: 22768839
Thanks Bro !!!


I understand......working good so far.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question