gxh973121

博客园 首页 新随笔 联系 订阅 管理

 

if exists(select * from tempdb.dbo.sysobjects where id=object_id(N'tempdb.dbo.#temp'))
drop table #temp

/*
SELECT * INTO #temp 
FROM OPENROWSET('SQLOLEDB',
'SERVER=.;UID=sa;PWD=1234567;DATABASE=MASTER',
'EXEC SP_LOCK') AS A

*/

/*
create table #temp
(
  spid int,
  dbid int,
  objid int,
  indid int,
  type  varchar(20),
  resource varchar(20),
  mode     varchar(10),
  status   varchar(20)
)
insert into #temp
exec sp_lock @@spid
*/

select spid,dbname=db_name(dbid),objname=object_name(objid),indexes=(select name from sysindexes where id =objid and indid=t.indid),
       type,resource,mode,status 
from #temp t
posted on 2006-03-23 11:29  gxh973121  阅读(671)  评论(0)    收藏  举报