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

mssql 创建触发器的更多相关文章

  1. mysql创建触发器

    触发器语句只有一句话 可以省略begin和end CREATE trigger `do_praise` after insert on praise for each row update post ...

  2. Oracle创建触发器实现主键自增

    CREATE OR REPLACE TRIGGER "trigger_empl" before insert on extjsTest1.t_empl for each row b ...

  3. oracle创建触发器及作用举例

    --创建触发器及作用举例 create or replace trigger tri before delete on emp --在删除emp表数据之前需要做的事根据自己的业务去写,before是在 ...

  4. 运维监控-使用Zabbix Server 创建触发器Triggers

    运维监控-使用Zabbix Server 创建触发器Triggers  作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 1>.点击相应主机的触发器 2>.点击创建触发器 ...

  5. PostgreSQL 创建触发器 Trigger

    触发器的知识点: PostgreSQL在以下情况下执行/调用触发器:在尝试操作之前(在检查约束并尝试INSERT,UPDATE或DELETE之前).或者在操作完成后(在检查约束并且INSERT,UPD ...

  6. 创建触发器(trigger)

    创建触发器 DROP TRIGGER IF EXISTS `ins_table_name`; DELIMITER ;; CREATE TRIGGER `ins_table_name` AFTER IN ...

  7. SQL Server 创建触发器(trigger)

    update 触发器: if(OBJECT_ID('trigger_compost_up') is not null) drop trigger trigger_compost_up go creat ...

  8. Zabbix 创建触发器

    #1   配置 主机名10.0.0.33 触发器 点击创建触发器 #2 #4 点击添加 #触发器添加完毕

  9. zabbix创建触发器

    1. 增加触发器 配置-->主机-->选择主机-->创建触发器 2. 配置触发器 3.查看触发器的状态 如果有问题会显示红色的问题

随机推荐

  1. c++/MFC 封装好的文件内存映射类

    整理日: 2015年2月16日 首先介绍内存映射文件操作------函数的用法以及先后执行顺序 // 第一步:创建文件 HANDLE hFile = CreateFileForMapping(_T(& ...

  2. python之requests-multipart/from-data

    示例代码:files = {"token":(None,token), "key":(None,key), "file":"hel ...

  3. IIs工作原理

    http://www.cnblogs.com/szhy222/archive/2008/07/14/1242576.html 问题: HTTP.SYS 的内置驱动程序 IIS 工作者进程

  4. new 与override 区别

    using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace Newover ...

  5. 【HDOJ】1908 Double Queue

    双端队列+二分. #include <cstdio> #define MAXN 1000005 typedef struct { int id; int p; } node_st; nod ...

  6. [LeetCode#202] Roman to Integer

    Problem: Write an algorithm to determine if a number is "happy". A happy number is a numbe ...

  7. dpkg error

    在ubuntu乱搞,突然出现错误 dpkg: error: cannot read info directory: No such file or directory E: Sub-process / ...

  8. C++下写的MD5类,简单易用

    //--------------------------------------------------------------------------- /////cpp文件 #pragma hdr ...

  9. 解决外部机器通过VM内ubuntu IP 无法访问vm内web服务的问题

    1. 2.i root@ubuntu:/home/udapeng# ifconfig root@ubuntu:/www/sentry# nano uwsgi.ini root@ubuntu:/www/ ...

  10. HDU 3045 Picnic Cows(斜率优化DP)

    Picnic Cows Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...