Solved

create SQL Calendar

Posted on 2008-10-21
3
212 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
count vs exists 9 59
Sql Data via Excel--performance issues 2 54
SQL Express connecting form remote error 26 7 38
Upgrading SQL 2005 Express to 2008 R2 Express 31 65
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

947 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now