--use TestDB alter proc Test.usp_LockTest WITH EXECUTE AS '伎' select convert (smallint, req_spid) As spid, loginame, db_name(rsc_dbid) As db_name, object_name(rsc_objid) As object_name, rsc_indid As IndId, substring (v.name, 1, 4) As Type, substring (rsc_text, 1, 32) as Resource, substring (u.name, 1, 8) As Mode, substring (x.name, 1, 5) As Status from master.dbo.syslockinfo, master.dbo.spt_values v, master.dbo.spt_values x, master.dbo.spt_values u, master.sys.sysprocesses z where master.dbo.syslockinfo.rsc_type = v.number and v.type = 'LR' and master.dbo.syslockinfo.req_status = x.number and x.type = 'LS' and master.dbo.syslockinfo.req_mode + 1 = u.number and u.type = 'L' and convert (smallint, req_spid) = z.spid and z.loginame = 'ろ' order by spid