>ALTER PROC dbo.sy_capture_auditdata >-- @parms parmtype >(@startdate datetime >,@stopdate datetime >,@debug int = 0 >) > >AS > >SET NOCOUNT ON >SET XACT_ABORT ON > >-- SQL CODE STARTS HERE >declare @view sysname > >declare hCForEach cursor global >for >select user_name(uid) + '.' + object_name(id) >from sysobjects o >where type = 'V' and o.category & 0x0002=0 > and name LIKE 'aud%' > >open hCForEach > >FETCH hCForEach INTO @view > >WHILE @@FETCH_STATUS >= 0 >BEGIN > > EXEC sy_write_audit_data @view,@startdate,@stopdate > > FETCH hCForEach INTO @view >END > >close hCForEach >deallocate hCForEach > >RETURN >>
>sp_MSforeachtable > "print '--------------------------------------' > print 'Triggers defined on ?' > print '--------------------------------------'", > "?", > "SELECT tr.name,'FOR INSERT' from sysobjects so > join sysobjects tr on tr.id=so.instrig > where so.id=OBJECT_ID('?') > UNION > SELECT tr.name,'FOR UPDATE' from sysobjects so > join sysobjects tr on tr.id=so.updtrig > where so.id=OBJECT_ID('?')", > "++UNION > SELECT tr.name,'FOR DELETE' from sysobjects so > join sysobjects tr on tr.id=so.deltrig > where so.id=OBJECT_ID('?')", > > @whereand='AND (instrig+updtrig+deltrig)>0' > GO >>