EXEMPLO_1212310
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_removetriggers
Parameters
Name
Type
Mode
Definition
create procedure sp_removetriggers as declare @nometabela sysname declare @usrlog varchar(255) declare @processolog varchar(100) declare @contextinfo varchar(300) declare @networkuser varchar(100) declare @machinename varchar(100) declare @machineip varchar(50) declare cursor_tabelas cursor for select distinct substring(NAME,10,len(name)) name from sysobjects where (name like 'LOGDELETE%' OR name like 'LOGINSERT%' OR name like 'LOGUPDATE%') AND TYPE = 'TR' order by name select @contextinfo = context_info from sysprocesses where spid = @@spid if @contextinfo = 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 set @usrlog= host_Name() else begin DECLARE @contextinfostring AS VARCHAR(500) SET @contextinfostring = convert(varchar(500), @contextinfo) SELECT * INTO #CURSOR FROM SPLIT(';', @contextinfostring) SELECT @usrlog = VALUE FROM #CURSOR WHERE ROWID = 1 SELECT @processolog = VALUE FROM #CURSOR WHERE ROWID = 2 SELECT @networkuser = VALUE FROM #CURSOR WHERE ROWID = 3 SELECT @machinename = VALUE FROM #CURSOR WHERE ROWID = 4 SELECT @machineip = VALUE FROM #CURSOR WHERE ROWID = 5 DROP TABLE #CURSOR end insert into zlog (tabela,coluna,dthora,usuario,valor,valorantigo,tiposql,chave,processo,networkuser,machinename,machineip) values ('ZLOGPARAMS','ATIVO',GETDATE(),@usrlog, 'N','S','U','CODIGO=1','Desativa Log',@networkuser,@machinename,@machineip) open cursor_tabelas fetch next from cursor_tabelas into @nometabela while @@fetch_status=0 begin exec sp_removetrigger @nometabela fetch next from cursor_tabelas into @nometabela end close cursor_tabelas deallocate cursor_tabelas