473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Lock Stored Procedure

Hello,

Can we lock stored procedure until its execution is complete ?
I dont want 2 clients to simultenously execute the stored procedure in
Sql Server 2000.
My front end is ASP.net 1.0

Thanks in advance.
waiting for the reply.
Jul 20 '05 #1
2 8964


A.V.C. wrote:
Hello,

Can we lock stored procedure until its execution is complete ?
I dont want 2 clients to simultenously execute the stored procedure in
Sql Server 2000.
My front end is ASP.net 1.0

Thanks in advance.
waiting for the reply.


Hi. I don't know if there is a better way, but you can certainly
make it lock a specific datum as it's first step, and release it
at the end. This way any second user running the procedure will hang
at the first step till the first runner is finished:
Pseudocode:

create proc myproc as
begin
begin tx
update my_single_row_proc_lock_table set val = 0 -- locks the one row in the table

...do all you want...

commit tran
end

Jul 20 '05 #2
[posted and mailed, please reply in news]

A.V.C. (yh*****************@hotmail.com) writes:
Can we lock stored procedure until its execution is complete ?
I dont want 2 clients to simultenously execute the stored procedure in
Sql Server 2000.


Application locks might be what you are looking for. Check out the
stored procedure sp_getapplock in Books Online.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: M Wells | last post by:
Hi All, I have a table that holds pregenerated member IDs. This table is used to assign an available member id to web site visitors who choose to register with the site So, conceptually the...
1
by: M Wells | last post by:
Hi All, I have a database that is serving a web site with reasonably high traffiic. We're getting errors at certain points where processes are being locked. In particular, one of our people...
1
by: imarchenko | last post by:
Hello! I am trying to investigate strange problem with particular stored procedure. It runs OK for several days and suddenly we start getting and lot of locks. The reason being lock placed on...
5
by: harborboy76 | last post by:
Hi all, First of all, just want to let you know that I'm coming from Informix background, and we just recently migrated to DB2. It's been a great new learning experience. For the time being, I...
8
by: Komandur Kannan | last post by:
We have a smart device application running on handhelds(Symbol MC9000G). The backend is Oracle and a middle tier web services development done in Vb.net. We use pessimistic Locking due to...
3
by: naveen.panambur | last post by:
We have an "Insert into XYZ_Table(seq_nbr, abc,def) select 3, abc,def from XYZ_TABLE where abc > ### " query in our application. This query is an COBOL Stored Procedure residing on DB2 Mainframes....
3
by: laststubborn | last post by:
Dear Memebers, I have a critical problem. I have an application is running on 64 bit machine. It used to be running on 32 bit machine. That application is using a Stored Procedure that uses...
2
by: Steve Richter | last post by:
what is the standard way of using sql in C# to increment a counter column in a shared control table? ( example: the next order number ) I would like to sql select a row in a table and lock it....
5
by: william.david.anderson | last post by:
Hi there, I have a newbie question regarding stored procedures and locking. I'm trying to use a stored procedure to perform a 'select for update' and return a cursor. Below is a stripped down...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.