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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Exclusive locks

Author  Topic 

nguyenl
Posting Yak Master

128 Posts

Posted - 2008-06-11 : 18:11:17
Hi,

How do you lock a table in exclusie mode before running a query?

thanks,

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2008-06-11 : 18:23:05
The quick answer is, "You don't!" The slightly longer answer is that the database itself will insure that your changes and someone else's changes don't collide. To give you the full answer, I'll ask that you give us some idea of what you are trying to do that you need/want to lock the table before running your query.

=======================================
We should try to be the parents of our future rather than the offspring of our past. -Miguel de Unamuno
Go to Top of Page

nguyenl
Posting Yak Master

128 Posts

Posted - 2008-06-11 : 18:35:16
Hi,

I am trying to lock a table and then do an "Insert Into" to make sure that nothing "collides". I am using SQl 2005.

Thx
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-11 : 18:40:13
Check out table-level locking hints in SQL Server Books Online.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

franklin
Starting Member

1 Post

Posted - 2009-01-15 : 04:36:33
Useful stuff, well done!
More references in this would be greatly appreciated.

Regards
Franklin
http://createmlm.com
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-15 : 05:12:15
quote:
Originally posted by nguyenl

I am trying to lock a table and then do an "Insert Into" to make sure that nothing "collides".
What do you mean with "collide"?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -