Concurrency checking with Last Change Time
Posted
by
Lijo
on Programmers
See other posts from Programmers
or by Lijo
Published on 2012-12-02T09:49:31Z
Indexed on
2012/12/02
11:20 UTC
Read the original article
Hit count: 295
I have a following three tables
- Email (emailNumber, Address)
- Recipients (reportNumber, emailNumber, lastChangeTime)
- Report (reportNumber, reportName)
I have a C#
application that uses inline queries for data selection.
I have a select query that selects all reports and their Recipients. Recipients are selected as comma separacted string.
During updating, I need to check concurrency
. Currently I am using MAX(lastChangeTime) for each reportNumber. This is selected as maxTime. Before update, it checks that the
lastChangeTime <= maxTime. --//It works fine
One of my co-developers asked why not use GETDATE()
as “maxTime” rather than using a MAX
operation. That is also working. Here what we are checking is the records are not updated after the record selection time
.
Is there any pitfalls in using GETDATE()
for this purpose?
© Programmers or respective owner