Forum Discussion
Database Locks
- 5 years ago
Hi Razorbx13 ,
I test it ,when I import data.
And I use the following to query if the table is locking in the sqlserver.
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT'Retrun me blank.
So in my opinion, when exporting, there is no lock, you can use the above query statement to query the lock process when you import slowly.Generally, locking a table only occurs when there are additions, deletions, and changes to the table.
View locked tables: select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT' spid lock Process tableName Locked Table Name Unlocked: declare @spid int Set @spid = 57 --Lock table process declare @sql varchar(1000) set @sql='kill '+cast(@spid as varchar) exec(@sql)Does Select query Lock the table
Did I answer your question? Mark my post as a solution!
Best RegardsLucien
Hi Razorbx13 ,
I test it ,when I import data.
And I use the following to query if the table is locking in the sqlserver.
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'
Retrun me blank.
So in my opinion, when exporting, there is no lock, you can use the above query statement to query the lock process when you import slowly.Generally, locking a table only occurs when there are additions, deletions, and changes to the table.
View locked tables:
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'
spid lock Process
tableName Locked Table Name
Unlocked:
declare @spid int
Set @spid = 57 --Lock table process
declare @sql varchar(1000)
set @sql='kill '+cast(@spid as varchar)
exec(@sql)
Does Select query Lock the table
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien