Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Record Locking Question

$
0
0

hi All,

I was oracle plsql programmer and now just started doing sql server stored procedure programming. seem like i can't find answer any where at this moment for some of my requirement.

i have the following requirement for a project with heavy multi user environment accessing same data at the same time.

I need to do the following:

1. I need to lock the row instead of table for every table that I need to issue update or delete statement. All other user must be able to read but can't update, delete that row.

2. during the updating, i want sqlserver to wait for 3 seconds max if the record is locked by other transaction. after 3 seconds, it will throw exception

in Oracle, they have something like this:

begin

select * from sales_order where order_no=@order_no for update wait 3;

exception

when no_data_found 

rollback;

raise_error();

when record_locked 

rollback;

raise_error();

end

any input is greatly appreciated.

Thanks,

Richard


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>