update invoiceDetailTbl Set DiscountPercent2=0 Where DiscountPercent2 is null Go set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[TRGOnDeleteinvoiceDetailTbl] ON [dbo].[invoiceDetailTbl] after delete AS BEGIN SET NOCOUNT ON; INSERT INTO [dbo].[ChangeinvoiceDetailTbl] ([GoodSysCode] ,[Comment] ,[Quantity] ,[Fee] ,[Unit] ,[UnitRate] ,[UserPrice] ,[SerialNo] ,[Size] ,[Color] ,[WareHouse] ,[FK_InvoiceSysCode] ,[DiscountPercent] ,[DiscountPercent2] ,[SysCode] ,[Term] ,[RowNo] ,[OnChangeUserId] ,[OnChangeSysDate] ,[IsUpDated]) select [GoodSysCode] ,[Comment] ,[Quantity] ,[Fee] ,[Unit] ,[UnitRate] ,[UserPrice] ,[SerialNo] ,[Size] ,[Color] ,[WareHouse] ,[FK_InvoiceSysCode] ,[DiscountPercent] ,[DiscountPercent2] ,[SysCode] ,[Term] ,[RowNo] ,dbo.funuserid() ,getdate() ,0 from deleted END