zoukankan      html  css  js  c++  java
  • mssql 创建触发器

    MS-SMS里创建触发器:

    首先右击表内的触发器文件夹图标

    然后输入触发器创建指令,一下案例:(添加创建时间)

    创建:

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:        <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:    <Description,,>
    -- =============================================
    CREATE TRIGGER [dbo].[trigger_gfsbj]
       ON  [dbo].[product] 
       FOR INSERT
    AS 
    BEGIN
        update o_product set pro_itime = getdate() from o_product as d inner join inserted as i on d.id=i.id
    END
    GO

    创建后:

    USE [GFSBJ]
    GO
    /****** Object:  Trigger [dbo].[trigger_gfsbj]    Script Date: 05/08/2016 13:04:21 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:        <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:    <Description,,>
    -- =============================================
    ALTER TRIGGER [dbo].[trigger_gfsbj]
       ON  [dbo].[product] 
       FOR INSERT
    AS 
    BEGIN
        update o_product set pro_itime = getdate() from o_product as d inner join inserted as i on d.id=i.id
    END
  • 相关阅读:
    es6扩展运算符深浅拷贝
    将工作慢慢移向python
    OpenGL
    翻译的一篇关于Normal Matrix (normal transformation)的文章
    顾城的诗
    复杂的C运行时库
    glut and glew
    setting boot up order in grub2
    Perlin Noise
    GL 与 CV 管线 (pipeline) 比较与相互转换
  • 原文地址:https://www.cnblogs.com/swack/p/5470407.html
Copyright © 2011-2022 走看看