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.
| Author |
Topic |
|
juicyapple
Posting Yak Master
176 Posts |
Posted - 2008-02-25 : 02:25:37
|
| Hi, I have written a service to rename table, how to check is the table is locked by another processes? There are some processes will execute select statement on it. The rename transaction must wait until all the select transactions have been finished.Thanks. |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-25 : 14:23:59
|
| Try check with sp_locks. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-26 : 01:51:45
|
quote: Originally posted by rmiao Try check with sp_locks.
Did you mean sp_lock?MadhivananFailing to plan is Planning to fail |
 |
|
|
juicyapple
Posting Yak Master
176 Posts |
Posted - 2008-02-27 : 23:19:02
|
| what is the objid returned in sp_lock?? how do I 'convert' it to string value? |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-02-27 : 23:39:10
|
You can find out the desired table's ID by Select OBJECT_ID([tablename])Then refer to that object ID in your check.OROBJECT_NAME([ID]) funtion will convert to string for you.Check books-on-line in the help menu, faster than a forum Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
juicyapple
Posting Yak Master
176 Posts |
Posted - 2008-02-29 : 03:28:18
|
| Hi, with using sp_lock, I can check all the objects locked by any of the client application or store procedure call (static sql or dinamic sql), locally and remotely? |
 |
|
|
|
|
|