Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Procedure Question

Posted on 2002-07-08
6
Medium Priority
?
143 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 43

Accepted Solution

by:
TimCottee earned 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses

618 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