Solved

SQL Procedure Question

Posted on 2002-07-08
6
139 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
[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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

691 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