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
  • 相关阅读:
    CF850A Five Dimensional Points 题解
    AT3963 [AGC024F] Simple Subsequence Problem 题解
    jquery事件绑定机制
    前端初级词汇
    一个checkbox细节处理方式(checkbox与后面的文字对其)
    转 CSS hack:针对IE6,IE7,firefox显示不同效果
    想到的几点页面规范
    jQuery UI Dialog:Demo2:实用技巧
    zindex
    递归示例
  • 原文地址:https://www.cnblogs.com/heimirror/p/1408113.html
Copyright © 2011-2022 走看看