SQLSerServer简单触发器同步Bak表
2022/8/24 2:22:53
本文主要是介绍SQLSerServer简单触发器同步Bak表,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
USE [ITL] GO /****** Object: Trigger [dbo].[TR_LMS_Interface_Order_INSERT] Script Date: 2022/8/23 17:16:48 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --然后存储过程 -- ============================================= -- Author: ljz1 -- Create date: 2011-05-13 21:04 -- Description: <Description,,> -- ============================================= ALTER TRIGGER [dbo].[TR_LMS_Interface_Order_INSERT] ON [dbo].[LMS_Interface_Order] FOR INSERT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @CustID AS CHAR(16); DECLARE @TypeID AS NVARCHAR(32); SELECT @CustID = Inserted.CustID , @TypeID = Inserted.TypeID FROM Inserted; IF NOT ( CHARINDEX(RTRIM(@CustID), '1300009477,1300000681') > 0 AND RTRIM(@TypeID) = '000000033' ) BEGIN INSERT INTO [LMS_Interface_Order_bak] ( RefID , Sign_Code , WareHouseProviderId , WareHouseCode , MidBusiID , PlanID_T , PlanID_F , StorkID_T , StorkID_F , CustomerID , CustID , OrderID , OrderCode , OrderType , TypeID , Operation_Type , Shipping , TradeID , CompanyCode , Presell , codflag , codItemValue , sendStartTime , sendEndTime , lmsItemNo , SpuCode , MaterialID , Qty , UnitPrice , MaterialSN , OperateRemark , Remark , LineCount , Item , OrderSendFlag , OutInflag , DelRemark , Marker1 , Marker2 , DelFlag , Creator , CreateTime , Modifier , ModifyTime , IPAddress , WarehouseID , ServiceCityID , ServiceName , PostCode , Phone , Mobile , [Address] , ItemName , ItemValue , SpuName , itemType , Prov , City , District , flag , [LOG] , Sign_Standard , VendeeCode , BatchCode , ERPFlag , InvoiceFlag , CarrierPay , DispatchDay , DispatchTime , DispatchNotify , DispatchCarrier , PrintRemark , BatchCode_To , Item_CustID , Item_CompID , Cust_StockID_F , Cust_PlanID_F , Cust_StockID_T , Cust_PlanID_T , Supplier , Buyer_ServiceName , Item_Remark , Insuranceflag , Insurancevalue , RouteID , DemandTime , IsCheckSN , Item_IsCheckSN , State_F , State_T , SpuCode_To , MaterialID_To , Item_SNFlag , CustID_T , SourceCode , ORDNO , Buyer_LevelInfo , Buyer_UserID , Sku_Size , PrevReference , ReTrafficnum , TrafficID , Customer_T , TransFlag , Shop_Nick , OrderTime , ShippingTime , Order_Flag , TMS_NO , cust_qty , GroupMaterFlag , Dealers , Town , SignInfo , Buyer_Email , GroupMaterialCode , GroupMaterialAreaID , packagepn , OrderLockFlag , ReOrderflag , Item_Remark1 , companyso , DOMemo , RefOrderCode , Marker3 , OrderWeight, Item_Marker1, Item_Marker2, Item_Marker3, Item_Remark2, --JHT-ADD oaid, --JHT-ADD TDOFlag ) SELECT ID , Sign_Code , WareHouseProviderId , WareHouseCode , MidBusiID , PlanID_T , PlanID_F , StorkID_T , StorkID_F , CustomerID , CustID , OrderID , OrderCode , OrderType , TypeID , Operation_Type , Shipping , TradeID , CompanyCode , Presell , codflag , codItemValue , sendStartTime , sendEndTime , lmsItemNo , SpuCode , MaterialID , Qty , UnitPrice , MaterialSN , OperateRemark , Remark , LineCount , Item , OrderSendFlag , OutInflag , DelRemark , Marker1 , Marker2 , DelFlag , Creator , CreateTime , Modifier , ModifyTime , IPAddress , WarehouseID , ServiceCityID , ServiceName , PostCode , Phone , Mobile , [Address] , ItemName , ItemValue , SpuName , itemType , Prov , City , District , flag , [LOG] , Sign_Standard , VendeeCode , BatchCode , ERPFlag , InvoiceFlag , CarrierPay , DispatchDay , DispatchTime , DispatchNotify , DispatchCarrier , PrintRemark , BatchCode_To , Item_CustID , Item_CompID , Cust_StockID_F , Cust_PlanID_F , Cust_StockID_T , Cust_PlanID_T , Supplier , Buyer_ServiceName , Item_Remark , Insuranceflag , Insurancevalue , RouteID , DemandTime , IsCheckSN , Item_IsCheckSN , State_F , State_T , SpuCode_To , MaterialID_To , Item_SNFlag , CustID_T , SourceCode , ORDNO , Buyer_LevelInfo , Buyer_UserID , Sku_Size , PrevReference , ReTrafficnum , TrafficID , Customer_T , TransFlag , Shop_Nick , OrderTime , ShippingTime , Order_Flag , TMS_NO , Cust_Qty , GroupMaterFlag , Dealers , Town , SignInfo , Buyer_Email , GroupMaterialCode , GroupMaterialAreaID , packagepn , OrderLockFlag , ReOrderflag , Item_Remark1 , companyso , DOMemo , RefOrderCode , Marker3 , OrderWeight, Item_Marker1, Item_Marker2, Item_Marker3, Item_Remark2, --JHT-ADD oaid,TDOFlag FROM INSERTED; END; END;
这篇关于SQLSerServer简单触发器同步Bak表的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-01-08Docker下的SqlServer发布订阅启用
- 2023-06-05Docker安装MS SQL Server并使用Navicat远程连接
- 2023-05-25深入浅出 SQL Server CDC 数据同步
- 2023-05-12通过空间占用和执行计划了解SQL Server的行存储索引
- 2023-04-24以SQLserver为例的Dapper详细讲解
- 2022-11-30SQL server高级函数查询
- 2022-11-26SQL SERVER数据库服务器CPU不能全部利用原因分析
- 2022-11-21SQL Server 时间算差值/常用函数
- 2022-11-20调试Archery连接SQL Server提示驱动错误
- 2022-10-22SQL Server 完整、差异备份+完整、差异还原(详细讲解,规避错误)