sql service 触发器,监控一个表有新数据插入时,把这条数据再插到另一个表
2016-07-07 09:38
639 查看
create trigger tri_Line on Line
for insert
as
begin
if (select count(1) from Line)=0
begin
print '未插入数据'
end
else
begin
insert into LineSubset(LineName)select LineName from inserted
end
end
或者
create trigger tri_Line on Line
for insert
as
begin
insert into LineSubset(LineName)
select LineName from inserted
end
for insert
as
begin
if (select count(1) from Line)=0
begin
print '未插入数据'
end
else
begin
insert into LineSubset(LineName)select LineName from inserted
end
end
或者
create trigger tri_Line on Line
for insert
as
begin
insert into LineSubset(LineName)
select LineName from inserted
end
相关文章推荐
- 恢复oracle中用pl/sql误删除drop掉的表
- Mysql 主从架构之-主从配置
- MySQL架构优化实战系列2:主从复制同步与查询性能调优
- 分布式系统架构——Mysql数据库实现主从同步
- MySQL架构优化实战系列1:数据类型与索引调优全解析
- sqlserver 2005 分布式架构 对等事务复制 .
- Mysql 主从架构之-安装与配置
- 日志监控系统中,大批量查询mysql方案
- MySQL的半同步复制监控
- open/close table on mysql
- PL/SQL报错:Initialization error Oracle client not properly installed
- 第二十九天 mysql基础架构、编译安装、客户端工具、数据类型及服务器变量
- Cent6.5下zabbix监控mysql5.6版本
- SQL Server 2016 CTP2.2安装配置方法图文教程
- SQLSERVER 中GO的作用详解
- SQL Server 2016 CTP2.2安装配置方法图文教程
- SqlBulkCopy插入1亿条数据需要20分钟?
- 安装SQL2008 R2出现 chould not open key:unknown\components
- 通过Sqoop实现Mysql / Oracle 与HDFS / Hbase互导数据
- 监控mysql索引使用效率的脚本