日期:2014-05-16 浏览次数:20598 次
use [数据库名]
go
-- 查询锁住该表的进程号
select request_session_id 'spid'
from sys.dm_tran_locks
where resource_type='OBJECT' and resource_database_id=db_id('[数据库名]')
and resource_associated_entity_id=object_id('hrbusidocitem')
-- 查询该进程执行的SQL语句
dbcc inputbuffer([进程号])
-- 必要时可强制结束进程
kill [进程号]
-- 然后再执行原来的语句
ALTER TABLE hrbusidocitem ADD census VARCHAR(20)