我已经对此做了很多研究,但是无法做到这一点.我正在尝试使用以下方法查询审计跟踪:
declare @batchid char (30)
select @batchid='13857584' --enter batch id here
declare @occurred int
select @occurred='5'
print 'Batch is in system, check MRN and encounter. User also noted below'
select a.encounter, a.mrn, a.facility, c.fullname, t.action_desc, a.occurred, a.remark
from audit..audit_trail a (nolock)
join cabinet..users c (nolock)
on a.userinstanceid=c.userinstanceid
join audit..action_table t (nolock)
on a.action=t.action
where a.REMARK like '%' + @batchid + '%'
and OCCURRED > GETDATE()-@occurred
order by a.occurred
Run Code Online (Sandbox Code Playgroud)
由于某种原因,它永远不会返回我想要的结果(没有结果).但是当我专门为下面的批处理ID运行它时(而不是@batchid)
declare @batchid char (30)
select @batchid='13857584' --enter batch id here
declare …Run Code Online (Sandbox Code Playgroud)