|
Eddy is correct, locking is not the issue here, also check to see if you have spit triggers on the table.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
He's talking about a SELECT statement, not an UPDATE . No amount of locking is going to speed up reading.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Any idea what that will do to a database that's not "well designed"? Really think it improves speed? Ever heard of the term "dirty read"??
Stop and THINK for a second - if it were a matter of adding that keyword, wouldn't it be more simple to have the dirty read by default, whether or not the keyword is included?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Aadhar Joshi wrote: please go through it when it actually creates problem..
Ah, sorry, something else ruined my mood - I'm gone.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
U please read the question..
he is talking about only 100 clients..
u know in a second how many number of locks sql can handle??
every time i don't belive i am good enough for all condition.. same applies to u also..
|
|
|
|
|
Aadhar Joshi wrote: he is talking about only 100 clients..
u know in a second how many number of locks sql can handle??
Yes, I do.
Aadhar Joshi wrote: every time i don't belive i am good enough for all condition.. same applies to u also..
Making mistakes is the only way I learn; trial and error, and the forum is filled with mistakes I made. Drop the subject and the assumptions, it should not have become this personal.
It's just code. Something we do.
Now excuse me, the hedonist in me is calling.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The reason I dislike the dirty read is because it's not fun if you have to debug a race-condition. Imagine the app being a huge success, and being used in another department with ten times the amount of users. Imagine a simple employee-count being incorrect, because only the employee-record has been inserted, but not yet the contract on which the query joins.
Having a consistent and reliable database is "always" more important than having a speedy one.
Yes, I'm always this rude, just not that touchy. Got some red wine, some red meat, it's time to relax a bit and have a party. It's good to see a dev with passion, and even better to see one defend his opinion. I hope you're gonna stick around, you'll see I'm not an arse all the time. (Sometimes I'm offline and asleep).
FWIW, you'll already have seen this[^] page? That's where you must have found the "cheat" to read before all writes are done. You'll have to assume that most programmers don't use the documentation. If it does not produce any problems with your current architecture, then great - means someone put some extra effort in designing the database. If not, mark it and highlight it and explain what it does with comments in code, as most programmers will not go to MSDN. They'll not even ask here.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I apologies for what i did..
I know i should listen you first but as u said i am a small kid and i need to go far away..
I can not compete with u, your knowledge, your points but as a senior u should have helping hands..
I can learn today a big lesson and now i can think i was fool for what i did and totally unprofessional..
I have to go far away, I hope i get support from u and u help a kid to grow up..
Sorry,
Aadhar
|
|
|
|
|
|
Aadhar Joshi wrote: I apologies for what i did..
So do I, my apologies for the way I acted.
Aadhar Joshi wrote:
I can learn today a big lesson and now i can think i was fool for what i did and totally unprofessional..
We both acted like fools for a few minutes. There's no need to compete; programming is a huge topic, it's impossible to cover all topics.
Aadhar Joshi wrote: I have to go far away, I hope i get support from u and u help a kid to grow up..
Just stick with your work, it's good to see someone who reads documentation and dares defend his opinion
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Well good for you! Being able to admit you were wrong is a BIG thing and will make you a better person. Don't let one lousy experience drive you away, stick around and learn we all do that! Oh and we all screw up occasionallyso don't let it stop you from learning.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Locking will not solve your problem. Just optimize your query for better performance.
|
|
|
|
|
One reason would be occurance of deadlock while executing the update query.
deadlock occurs at that time you are trying to do multiple operation on the same table at the same time.
e.g. select and update both operations are done on same table same time then deadlock will occurs.
To avoid this situation use no lock in your select query and use update lock in your update query.
|
|
|
|
|
Greetings. I'm having a problem that is we have a fingerprint devices in the factory, we have 2 work shifts OK so the security guys must switch the devices from "in state" to "out state" so that the [in/out mode] in the database being 0 "means attend state" it changes to 1 "means leave state", and vice versa. The problem is that sometimes the security guys forget to change the state of the device to in mode or out mode in the proper time so all the coming records will be wrong for example an employee will have 2 records one at 8:00:00 AM with an in/out mode value 0 and another one at 4:00:00 PM again with in/out mode value 0 instead of 1 so what I want is to adjust such records so that the returned data be correct. Here is the table of the attendance and leave log
We have 2 shifts on starts at 8:00:00 AM and ends at 4:00:00 PM and another starts at 6:30:00 PM and ends on the next day at 8:00:00 AM, that it is, one starts and ends in the same day and another starts on a day and ends on another day. So I want to adjust such invalid records before retrieving the data to based on work shift.
HR_Attend_And_Leave_Of_Staff: [Record No.], [Machine ID], [Employee ID], [Verify Mode] having value 1 if verify mode is a fingerprint or 15 if the mode is face, [In/Out Mode] having 0 for attendance 1 for leave, [Date], [Time]
HR_Employee_Job_Info: [Employee ID], [Shift ID]
|
|
|
|
|
The question arises, do you want to fix the problem after the fact or change the business process before the error happens. Can you raise a dialog from the timekeeping s/w if the mode has not been switched at a specified time.
Otherwise you need to look for paired 0 or 1 valued records in the database and flip the second occurrence.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I want to call a method to correct such data within the database table before calling another one the retrieving the attendance records for employees whereas the person who is responsible for obtaining the staff attendance data. So what I want is a SQL statement(s) that correct such wrong data within the table itself before I retrieve the attendance data. Hope my idea is clear thanks for support in advance
|
|
|
|
|
So the second suggestion is the way to go. Look for the paired 0 and 1 records in sequence within a period of time and flip sign on the second occurrence.
I would break this down to a number of steps:
Get the last 2 records for each person
Check if the sign is the same
Get the last record based on date/time.
Flip it's sign
1 and 2 may be combined into 1 query
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Consider this logic ...
A fingerprint swipe comes from the device
A query is made to the database as to the last time the employee has clocked on
If the employee has not clocked on in 16 hours (some value which represents the longest shift), then the tranasction should be considered an "ON" transaction; otherwise it must be an "OFF" transaction.
When querying your database, if you don't find matching On/Off transactions for a given shift, then you could have an "assumed Off" which is equal to the On time plus the scheduled duration of the shift.
To make this work, your really need to know the shift duration for the employee scheduled on a particular day.
Hope this helps.
|
|
|
|
|
Seems to me that if the security crew has to switch the on/off at the same times each day, you can easily use the time to decide whether it is an in/out punch. In fact, why is there a switch anyway?
We reconcile via a pre-determined schedule for each employee. They should be at the clock at the beginning and end of each shift. If there are missing punches that correspond with these times, a supervisor has to manually reconcile the work day for the erred employee. We gave up on trying to identify a punch as in/out at the time of punch a long time ago.
|
|
|
|
|
The fingerprint device is working that way. It is manufactured with that switch button. So if the employee of a given shift was about leaving while the security guys did not change the in/out state of the fingerprint device and that employee put his finger he will have 2 records each with in state and when reading the data this employee considered did not record leaving state. On the other hand, if the employee of a second shift came before his shift start time and the security guys did not switch the device from out state "as they changed the in state to out state at the end of the first shift" and that employee puts his finger so the final result that this employee has 2 records with a leave state. Such matter of wrong records is a case sensitive as the company will depend on the data in calculating the overtime and in salary discount(s). I hope my idea is clear now. The shift 1 and shift 2 begins and ends on 08:00:00 AM - 04:00:00 PM and 06:30:00 PM - 08:00:00 AM on the next day.
|
|
|
|
|
Hello,
Is it possible to get a list of the jobs running on a sql server, with their names and scheduled timing of run?
Thank you!
|
|
|
|