473,785 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Server Isolation Level - Table Locks

24 New Member
Hello,

I ran into a problem, where I am not sure how sql server is reacting -

There is a table dbo.T1 with columns (OWNER, DATA)- now I have 3 stored procs - dbo.Begin, dbo.Copy, dbo.END.

There is a process running which reads a file (file contains - OWNER and DATA) and calls these procs in the sequence dbo.Begin, dbo.Copy, dbo.END.

dbo.Begin proc deletes the data from dbo.T1 table where OWNER='X'
dbo.Copy proc copies the data to dbo.T1 table. (So this time all the existing data for this owner 'X' is deleted from the table T1)
dbo.END proc grabs the copied data from the table T1 and distribute in multiple tables.


Now my question is - if there is a file f1.txt placed so dbo.Begin will clear data from T1 table and after then dbo.Copy will start copying the data from f1.txt table dbo.T1. Now - if a new file f2.txt for the same Owner is placed - dbo.Begin will start clearing the data - but the problem is earlier execution of dbo.Copy is not yet finished. So this may be a problem and the 2nd instance of dbo.Begin might NOT delete all the data from table T1.

Please advice how this could be handles, I think SQL setver would take care of itself by having locks on the table T1, but not exactly sure how.

Any help is appreciated. Thanks
Jun 4 '08 #1
1 1479
Delerna
1,134 Recognized Expert Top Contributor
Im not absolutely sure either, but I think so.
If you are worried about it though then you could create a table that only ever has either 1 or no records in it. Or only 1 or no records for a particular user. Or some other scheme that satisfies you.

The first stored proc in the sequence first checks to see if a record exist.
if not then it adds a record and allows the stored proc to run.
if so it reports back to the caller that they have to wait their turn.

The last stored proc then deletes the record from the table after it has finished.
I have only sketched the idea here and you will need to work out the exact details to make it work for you.

The Idea can't hurt performance much and might give you peace of mind, even if unnecessary!
Jun 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5972
by: Jeff Roughgarden | last post by:
I was at a conference and had it asserted to me by an Oracle afficiando that Oracle and DB2 handled low-level locks "better" than SQL Server, and that this was likely the cause of SQL Server's relatively slower and more deadlock-prone performance when running the same application. (SQL does seem to perform more poorly for this app, a PeopleSoft customer service and billing app.) Is there any significant difference in lock escalation...
5
5462
by: Ritesh | last post by:
Hi All, According to my observation using SP_WHO2 in my database, some INSERT statements are getting blocked by SELECT statements. Though the blocking SELECT statement is having ReadPast hint, i think, it will only read past locked resources but will not guarantee the select statement itself not blocking other statements(in my case Insert). According to my knowledge
4
14885
by: Eddie | last post by:
I wondering which one of the following I should use to get the best performance. 1. "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" OR 2. "WITH (NOLOCK)" I notice that when I use the #1 "SET TRANSACTION..." it sets a lock Mode type of "Sch-S" (Schema stability Lock) which described by SQL Books Online as "Schema stability (Sch-S) locks do not block any transactional locks, including exclusive (X) locks"
2
8855
by: klh | last post by:
We use DB2 Connect v 7.2 FP7 in Windows NT hitting a OS/390 DB2 v7.1 database. We have a Websphere (java) application that issues dynamic SQL. Most of the time when we issue dynamic SQL SELECT statements, like through a DB2 command window, the command will be processed using a package like SQLLF000 which uses an isolation level of Cursor Stability. However sometimes in the Websphere application when a dynamic SELECT statement is issued...
9
2914
by: yu_sha | last post by:
Hello everyone We have a bunch of components registered under COM+ with 'transaction required' option. On the client we are using iSeries Access 5.2.0, with all possible fixes applied (Service level SI16136, iSeries ODBC driver version 9.00.09.00). Server is DB2/AS400 05.02.0001 (that's what ODBC driver reports. So, I
2
8014
by: Larry Bertolini | last post by:
Is there a way to read data from a linked server, within a transaction, without using DTC? The data on the linked server is static, therefore there is no need for two-phase commit. There is no need for locking data on the linked server, because it is not being updated (either from the remote server, or from the local server). I don't want to run DTC because:
2
6968
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
1
4370
by: Guedes | last post by:
Hello all, I am new at SQL Server 2005 and have been reading everything I canfind about the new optimistic concurrency control mechanisms. As far as I can tell, the Snapshot Isolation Level is based avoids the use of shared locks using rowversioning instead. To control rowversions in SQL Server 2000 I was using an extra column in each table containing a rowversion datatype. What i do with this is
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.