Solved

SQL Procedure Question

Posted on 2002-07-08
6
135 Views
Last Modified: 2010-05-02
I have a tracking tool that keeps track of hours worked and hours taken beginning January 1 - December 31.  I have several stored procedures running everyday to add time to the SQL DB for the person's record based on the hire date.

The problem is when they take time and the balance returns to 0.

My question is:  How do I prevent my automatic SP's from giving the employee a new set of balances when they reach 0 during the year.
0
Comment
Question by:baddogi
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:jdc0724
ID: 7137724
A little more info specifically detailing the problem would be helpful.  You say "The problem is when they take time and the balance returns to 0".  I am assuming this could happen if say your hire date was today, you work eight hours today, and then take 8 hours off tomorrrow, leaving your balance with 0???"

What new set of balances are the Stored Procedures giving you when they reach 0??  

Cheers,
JDC0724
0
 

Author Comment

by:baddogi
ID: 7137747
Here is some more info:

Our company policy is to give employees personal and sick time based on their hire date.  Everyone begins with 0.

I have a stored procedure that checks if the balance is 0 and then adds the appropriate time.  Let's say on May 1, John Doe is eligable for 40 hours sick time and 16 hours personal time.  This stored procedure runs every day to check the difference between the hiredate and today's date.

The problem lies in that during the year once they deplete their balance back to 0, then the stored procedure will see that the balance is 0 and then give them another 40 hours of sick and 16 hours personal time in that same year.

I need some way to stop that stored procedure from running a second time within the year.

Any ideas?>
0
 

Author Comment

by:baddogi
ID: 7137749
Here is some more info:

Our company policy is to give employees personal and sick time based on their hire date.  Everyone begins with 0.

I have a stored procedure that checks if the balance is 0 and then adds the appropriate time.  Let's say on May 1, John Doe is eligable for 40 hours sick time and 16 hours personal time.  This stored procedure runs every day to check the difference between the hiredate and today's date.

The problem lies in that during the year once they deplete their balance back to 0, then the stored procedure will see that the balance is 0 and then give them another 40 hours of sick and 16 hours personal time in that same year.

I need some way to stop that stored procedure from running a second time within the year.

Any ideas?>
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 7137781
Check the other field/table that records whether they have taken any time during the year. (You do have one of course!) If there are any entries/values there then don't add the values back in!
0
 

Author Comment

by:baddogi
ID: 7137813
Thanks -  I should have thought of that :(

This should take care of it....
0
 
LVL 1

Expert Comment

by:jdc0724
ID: 7137828
I am assuming that there is a set amount of months that an employee needs to work to be eligible for sick and personal time:

=== This stored procedure runs every day to check the difference between the hiredate and today's date.

Say after 6 months they become eligible and later that year they deplete the time back to 0.  Change your stored procedure to calculate the number of months between the hire date and todays date.  If greater than 6 months, and the employee has 0 time left, then you know that they have used everything for that year.  If less than or equal to 6 months, the stored procedure should do what it currently does.

Cheers,
JDC0724

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

18 Experts available now in Live!

Get 1:1 Help Now