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
  • 相关阅读:
    android ListView 获取点击的选项
    架构流程笔记
    关键字搜索
    利用HttpWebRequest模拟提交图片
    (一)phonegap自学---不会java也会写原生app
    js正则笔记
    jQuery插件编写,
    存储过程分页
    JavaScript中的this陷阱
    jQuery.Deferred(jQuery1.5-2.1)源码剖析
  • 原文地址:https://www.cnblogs.com/heimirror/p/1408113.html
Copyright © 2011-2022 走看看