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
 TABLOCK x with Delete command.

Author  Topic 

hspatil31
Posting Yak Master

182 Posts

Posted - 2011-08-29 : 11:06:40
Dear All,

I am using following delete command for deleting a millions of record from table. I want use TABLOCK in the same command.
So can anybody suggest me how to use TABLOCK x in delete command.

delete from
dbo.abc
where a ='E0447E67-FD8B-4B68-973E-9E1E0E977491'

Thanks and Regard's
Harish Patil

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-29 : 11:08:38
not sure why you want to do this

delete from
dbo.abc with (tablock)
where a ='E0447E67-FD8B-4B68-973E-9E1E0E977491'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

hspatil31
Posting Yak Master

182 Posts

Posted - 2011-08-29 : 12:15:10
Because in my table having crore of record. So i want to delete 15 lakhs record. I thought table locking problem will come. That's y i am using TABLOCK.

Thnks,
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-29 : 12:24:16
ok fine.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-08-29 : 12:30:47
You realise that will completely prevent any other access to the table while the delete is running?

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -