--* Mp 18.10.2006 Naredi Trigger na tabelo tsiKonPlanAnal --* Beleži spremembe v datoteko tfsTabelaLog --* Če beleženja ne želiš, izvedi le DROP TRIGGER , ali naredi Trigger ponovno tako, da bo --* prvi ukaz Return, npr.: --* CREATE TRIGGER tsiKonPlanAnal ON tsiKonPlanAnal FOR UPDATE, DELETE, INSERT --* NOT FOR REPLICATION --* AS --* Return --* Declare ... --* ... IF EXISTS (SELECT name FROM sysobjects WHERE name = 'tsiKonPlanAnalLog' AND type = 'TR') DROP TRIGGER tsiKonPlanAnalLog go CREATE TRIGGER tsiKonPlanAnalLog ON tsiKonPlanAnal FOR UPDATE, DELETE, INSERT NOT FOR REPLICATION AS -- Mp 18.10.2006 Beleži spremembe tabele tsiKonPlanAnal Declare @TableName varchar(50) Declare @PKName varchar(50) Declare @CurrentUser nVarChar(20) Declare @UpdateDate datetime Declare @Workstation Varchar(50) Declare @sAction VarChar(10) Select @TableName= 'tsiKonPlanAnal' Select @PKName= 'Zaporedje' Select @CurrentUser = system_user Select @UpdateDate = convert(varchar(8), getdate(), 112) + ' ' + convert(varchar(8), getdate(), 108) Select @Workstation = host_name() IF @@RowCount <> 1 Return SET NoCount On IF EXISTS(SELECT * FROM inserted) AND EXISTS(SELECT * FROM deleted) SET @sAction = 'UPDATE' ELSE IF EXISTS(SELECT * FROM inserted) SET @sAction = 'INSERT' ELSE SET @sAction = 'DELETE' If @sAction = 'INSERT' Begin INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoIDP', NULL, Inserted.KontoIDP FROM INSERTED WHERE Inserted.KontoIDP Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoID', NULL, Inserted.KontoID FROM INSERTED WHERE Inserted.KontoID Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoNaziv', NULL, Inserted.KontoNaziv FROM INSERTED WHERE Inserted.KontoNaziv Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoStatus', NULL, Inserted.KontoStatus FROM INSERTED WHERE Inserted.KontoStatus Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'StranKnj', NULL, Inserted.StranKnj FROM INSERTED WHERE Inserted.StranKnj Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeSm', NULL, Inserted.JeSm FROM INSERTED WHERE Inserted.JeSm Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeNosil', NULL, Inserted.JeNosil FROM INSERTED WHERE Inserted.JeNosil Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeZakl', NULL, Inserted.JeZakl FROM INSERTED WHERE Inserted.JeZakl Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeDevizen', NULL, Inserted.JeDevizen FROM INSERTED WHERE Inserted.JeDevizen Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Zdruzi', NULL, Inserted.Zdruzi FROM INSERTED WHERE Inserted.Zdruzi Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'ZdruziOpis', NULL, Inserted.ZdruziOpis FROM INSERTED WHERE Inserted.ZdruziOpis Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'EvidKonto', NULL, Inserted.EvidKonto FROM INSERTED WHERE Inserted.EvidKonto Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeEvid', NULL, Inserted.JeEvid FROM INSERTED WHERE Inserted.JeEvid Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoNazivAng', NULL, Inserted.KontoNazivAng FROM INSERTED WHERE Inserted.KontoNazivAng Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoNazivNem', NULL, Inserted.KontoNazivNem FROM INSERTED WHERE Inserted.KontoNazivNem Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'ZaFakture', NULL, Inserted.ZaFakture FROM INSERTED WHERE Inserted.ZaFakture Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KolonaSKB', NULL, Inserted.KolonaSKB FROM INSERTED WHERE Inserted.KolonaSKB Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'ValutaIDSKB', NULL, Inserted.ValutaIDSKB FROM INSERTED WHERE Inserted.ValutaIDSKB Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'PartnerIDSKB', NULL, Inserted.PartnerIDSKB FROM INSERTED WHERE Inserted.PartnerIDSKB Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'DKSKB', NULL, Inserted.DKSKB FROM INSERTED WHERE Inserted.DKSKB Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KreditiSKB', NULL, Inserted.KreditiSKB FROM INSERTED WHERE Inserted.KreditiSKB Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'EvidStatus', NULL, Inserted.EvidStatus FROM INSERTED WHERE Inserted.EvidStatus Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Ecl', NULL, Inserted.Ecl FROM INSERTED WHERE Inserted.Ecl Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'ZaBlagajno', NULL, Inserted.ZaBlagajno FROM INSERTED WHERE Inserted.ZaBlagajno Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'VidenVProj', NULL, Inserted.VidenVProj FROM INSERTED WHERE Inserted.VidenVProj Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'NovKontoID', NULL, Inserted.NovKontoID FROM INSERTED WHERE Inserted.NovKontoID Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Saldo', NULL, Inserted.Saldo FROM INSERTED WHERE Inserted.Saldo Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'NiVKonsBil', NULL, Inserted.NiVKonsBil FROM INSERTED WHERE Inserted.NiVKonsBil Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Sektor', NULL, Inserted.Sektor FROM INSERTED WHERE Inserted.Sektor Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'OznakaFinInstr', NULL, Inserted.OznakaFinInstr FROM INSERTED WHERE Inserted.OznakaFinInstr Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Mars', NULL, Inserted.Mars FROM INSERTED WHERE Inserted.Mars Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'VrstaObrazca', NULL, Inserted.VrstaObrazca FROM INSERTED WHERE Inserted.VrstaObrazca Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'Zaporedje', NULL, Inserted.Zaporedje FROM INSERTED WHERE Inserted.Zaporedje Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'EvidProcent', NULL, CAST(Inserted.EvidProcent AS nVarChar(255)) FROM INSERTED WHERE Inserted.EvidProcent Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'KontoIDA', NULL, Inserted.KontoIDA FROM INSERTED WHERE Inserted.KontoIDA Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeOpomin', NULL, Inserted.JeOpomin FROM INSERTED WHERE Inserted.JeOpomin Is Not Null INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Insert', @PKName, Inserted.Zaporedje, 'JeOs', NULL, Inserted.JeOs FROM INSERTED WHERE Inserted.JeOs Is Not Null End If @sAction = 'UPDATE' Begin INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoIDP', Deleted.KontoIDP, Inserted.KontoIDP FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoIDP, '')<>IsNull(Inserted.KontoIDP, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoID', Deleted.KontoID, Inserted.KontoID FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoID, '')<>IsNull(Inserted.KontoID, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoNaziv', Deleted.KontoNaziv, Inserted.KontoNaziv FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoNaziv, '')<>IsNull(Inserted.KontoNaziv, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoStatus', Deleted.KontoStatus, Inserted.KontoStatus FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoStatus, '')<>IsNull(Inserted.KontoStatus, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'StranKnj', Deleted.StranKnj, Inserted.StranKnj FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.StranKnj, '')<>IsNull(Inserted.StranKnj, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeSm', Deleted.JeSm, Inserted.JeSm FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeSm, '')<>IsNull(Inserted.JeSm, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeNosil', Deleted.JeNosil, Inserted.JeNosil FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeNosil, '')<>IsNull(Inserted.JeNosil, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeZakl', Deleted.JeZakl, Inserted.JeZakl FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeZakl, '')<>IsNull(Inserted.JeZakl, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeDevizen', Deleted.JeDevizen, Inserted.JeDevizen FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeDevizen, '')<>IsNull(Inserted.JeDevizen, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Zdruzi', Deleted.Zdruzi, Inserted.Zdruzi FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Zdruzi, '')<>IsNull(Inserted.Zdruzi, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'ZdruziOpis', Deleted.ZdruziOpis, Inserted.ZdruziOpis FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.ZdruziOpis, '')<>IsNull(Inserted.ZdruziOpis, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'EvidKonto', Deleted.EvidKonto, Inserted.EvidKonto FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.EvidKonto, '')<>IsNull(Inserted.EvidKonto, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeEvid', Deleted.JeEvid, Inserted.JeEvid FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeEvid, '')<>IsNull(Inserted.JeEvid, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoNazivAng', Deleted.KontoNazivAng, Inserted.KontoNazivAng FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoNazivAng, '')<>IsNull(Inserted.KontoNazivAng, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoNazivNem', Deleted.KontoNazivNem, Inserted.KontoNazivNem FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoNazivNem, '')<>IsNull(Inserted.KontoNazivNem, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'ZaFakture', Deleted.ZaFakture, Inserted.ZaFakture FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.ZaFakture, '')<>IsNull(Inserted.ZaFakture, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KolonaSKB', Deleted.KolonaSKB, Inserted.KolonaSKB FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KolonaSKB, '')<>IsNull(Inserted.KolonaSKB, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'ValutaIDSKB', Deleted.ValutaIDSKB, Inserted.ValutaIDSKB FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.ValutaIDSKB, '')<>IsNull(Inserted.ValutaIDSKB, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'PartnerIDSKB', Deleted.PartnerIDSKB, Inserted.PartnerIDSKB FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.PartnerIDSKB, '')<>IsNull(Inserted.PartnerIDSKB, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'DKSKB', Deleted.DKSKB, Inserted.DKSKB FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.DKSKB, '')<>IsNull(Inserted.DKSKB, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KreditiSKB', Deleted.KreditiSKB, Inserted.KreditiSKB FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KreditiSKB, '')<>IsNull(Inserted.KreditiSKB, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'EvidStatus', Deleted.EvidStatus, Inserted.EvidStatus FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.EvidStatus, '')<>IsNull(Inserted.EvidStatus, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Ecl', Deleted.Ecl, Inserted.Ecl FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Ecl, '')<>IsNull(Inserted.Ecl, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'ZaBlagajno', Deleted.ZaBlagajno, Inserted.ZaBlagajno FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.ZaBlagajno, '')<>IsNull(Inserted.ZaBlagajno, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'VidenVProj', Deleted.VidenVProj, Inserted.VidenVProj FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.VidenVProj, '')<>IsNull(Inserted.VidenVProj, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'NovKontoID', Deleted.NovKontoID, Inserted.NovKontoID FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.NovKontoID, '')<>IsNull(Inserted.NovKontoID, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Saldo', Deleted.Saldo, Inserted.Saldo FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Saldo, '')<>IsNull(Inserted.Saldo, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'NiVKonsBil', Deleted.NiVKonsBil, Inserted.NiVKonsBil FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.NiVKonsBil, '')<>IsNull(Inserted.NiVKonsBil, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Sektor', Deleted.Sektor, Inserted.Sektor FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Sektor, '')<>IsNull(Inserted.Sektor, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'OznakaFinInstr', Deleted.OznakaFinInstr, Inserted.OznakaFinInstr FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.OznakaFinInstr, '')<>IsNull(Inserted.OznakaFinInstr, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Mars', Deleted.Mars, Inserted.Mars FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Mars, '')<>IsNull(Inserted.Mars, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'VrstaObrazca', Deleted.VrstaObrazca, Inserted.VrstaObrazca FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.VrstaObrazca, '')<>IsNull(Inserted.VrstaObrazca, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'Zaporedje', Deleted.Zaporedje, Inserted.Zaporedje FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.Zaporedje, '')<>IsNull(Inserted.Zaporedje, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'EvidProcent', CAST(Deleted.EvidProcent AS nVarChar(255)), CAST(Inserted.EvidProcent AS nVarChar(255)) FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.EvidProcent,0)<>IsNull(Inserted.EvidProcent,0) INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'KontoIDA', Deleted.KontoIDA, Inserted.KontoIDA FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.KontoIDA, '')<>IsNull(Inserted.KontoIDA, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeOpomin', Deleted.JeOpomin, Inserted.JeOpomin FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeOpomin, '')<>IsNull(Inserted.JeOpomin, '') INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName,'Update', @PKName, Inserted.Zaporedje, 'JeOs', Deleted.JeOs, Inserted.JeOs FROM INSERTED INNER JOIN DELETED ON INSERTED.Zaporedje=DELETED.Zaporedje WHERE IsNull(Deleted.JeOs, '')<>IsNull(Inserted.JeOs, '') End If @sAction = 'DELETE' Begin INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoIDP', Deleted.KontoIDP, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoID', Deleted.KontoID, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoNaziv', Deleted.KontoNaziv, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoStatus', Deleted.KontoStatus, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'StranKnj', Deleted.StranKnj, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeSm', Deleted.JeSm, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeNosil', Deleted.JeNosil, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeZakl', Deleted.JeZakl, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeDevizen', Deleted.JeDevizen, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Zdruzi', Deleted.Zdruzi, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'ZdruziOpis', Deleted.ZdruziOpis, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'EvidKonto', Deleted.EvidKonto, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeEvid', Deleted.JeEvid, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoNazivAng', Deleted.KontoNazivAng, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoNazivNem', Deleted.KontoNazivNem, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'ZaFakture', Deleted.ZaFakture, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KolonaSKB', Deleted.KolonaSKB, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'ValutaIDSKB', Deleted.ValutaIDSKB, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'PartnerIDSKB', Deleted.PartnerIDSKB, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'DKSKB', Deleted.DKSKB, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KreditiSKB', Deleted.KreditiSKB, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'EvidStatus', Deleted.EvidStatus, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Ecl', Deleted.Ecl, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'ZaBlagajno', Deleted.ZaBlagajno, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'VidenVProj', Deleted.VidenVProj, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'NovKontoID', Deleted.NovKontoID, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Saldo', Deleted.Saldo, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'NiVKonsBil', Deleted.NiVKonsBil, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Sektor', Deleted.Sektor, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'OznakaFinInstr', Deleted.OznakaFinInstr, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Mars', Deleted.Mars, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'VrstaObrazca', Deleted.VrstaObrazca, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'Zaporedje', Deleted.Zaporedje, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'EvidProcent', CAST(Deleted.EvidProcent AS nVarChar(255)), Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'KontoIDA', Deleted.KontoIDA, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeOpomin', Deleted.JeOpomin, Null FROM DELETED INSERT INTO tfsTabelaLog (recDateTime, WorkstationID, CurrentUser, TableName, TableAction, recIDField, recID, FieldName, OldValue, NewValue) SELECT @UpdateDate, @Workstation, @CurrentUser, @TableName, 'Delete', @PKName, Deleted.Zaporedje, 'JeOs', Deleted.JeOs, Null FROM DELETED End