Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can I lock the record which I am reading ?

Author  Topic 

sunnykj
Starting Member

29 Posts

Posted - 2005-08-30 : 22:08:23
Can I lock the record which I am selecting ?
I want this lock is row level,not transaction level.
How to do it,please tell me.

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2005-08-31 : 02:35:47
Use a CURSOR with SCROLL_LOCKS option

Hemanth Gorijala
I Came. I Saw. I Normalized.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-31 : 02:51:08
If you mean to have equivalent of Select row for update in Oracle use UPDLOCK

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sunnykj
Starting Member

29 Posts

Posted - 2005-08-31 : 21:51:05
Mr madhivanan,
Is there the same sql statement like the Oracle's "UPDLOCK" in SQL Server ?
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-08-31 : 22:13:51
UPDLOCK is a hint you can use in your SELECT statement. It puts an update lock in place instead of the usual shared lock. This gives you the same type of functionality as SELECT FOR UPDATE in Oracle.

more information can be found in BOL or do a google search on "SQL Server" and UPDLOCK.



-ec
Go to Top of Page

sunnykj
Starting Member

29 Posts

Posted - 2005-09-07 : 01:18:38
3ks,You are right!
Go to Top of Page
   

- Advertisement -