zoukankan      html  css  js  c++  java
  • 用触发器替换原来的insert

    alter TRIGGER InsertEnterprise
       
    ON T_Enterprise
      instead 
    of INSERT 
    AS 
    BEGIN
        
    SET NOCOUNT ON;
        
    SET QUOTED_IDENTIFIER ON;
        
    declare @TempId int
        
    insert into fieldweb.dbo.enterpriseinfo(companyname,ServicesType,Location
        ,E_Code,EnterpriseNO)
        
    select companyname,industryid,address,postcode,enterprisecode from inserted
        
    select  @TempId=@@identity

        
    INSERT INTO [CRM].[dbo].[T_Enterprise]
               (
    [CompanyName]
               ,
    [EnterpriseCode]
               ,
    [WebSiteId]
               ,
    [IndustryId]
               ,
    [IndustryName]
               ,
    [NatrueId]
               ,
    [NatrueName]
               ,
    [Address]
               ,
    [PostCode]
               ,
    [WebUrl]
               ,
    [AddTime]
               ,
    [Operator])
               
    select
                
    [CompanyName]
               ,
    [EnterpriseCode]
               ,
    [WebSiteId]
               ,
    [IndustryId]
               ,
    [IndustryName]
               ,
    [NatrueId]
               ,
    [NatrueName]
               ,
    [Address]
               ,
    [PostCode]
               ,
    [WebUrl]
               ,
    [AddTime]
               ,
    [Operator]
                
    from inserted
        
    update t_enterprise set websiteid=@TempId where id=@@identity
        
    END
    GO
  • 相关阅读:
    LaTex 2
    Haskell语言练习
    TypeScript语言学习笔记(2)接口,类
    正则表达式(TypeScript, JavaScript)
    Angular2学习笔记
    Haskell语言学习笔记(71)Semigroup
    正则表达式(Kotlin)
    TypeScript语言学习笔记(1)基本类型,变量声明
    Kotlin语言编程技巧集
    多线程(Java)
  • 原文地址:https://www.cnblogs.com/heimirror/p/1408113.html
Copyright © 2011-2022 走看看