sql server2008触发器

sql server在Navicat工具不能插入数据

可以去写代码插入,代码连接sql server可以插入

或者使用sql server专门的工具

复制代码
BEGIN
	declare @a int;
	declare @s t_amount;
	select @a = baddebt_age_id,@s=rate from aa_baddebt_age;
  INSERT INTO dade(id,name) VALUES(@a,@s)
END

1、插入触发器

复制代码
set nocount on
declare 
  @shopid int,
begin	
  select @shopid = shopid from inserted		
	INSERT INTO dade(table_name,table_id,table_id_name,type,state) VALUES('d_shop',@shopid,'shopid',1,1)
end

2、更新触发器

复制代码
if update (lcode)
begin	
  set nocount on
  declare	 @shopid int
  select @shopid=shopid from inserted
  INSERT INTO dade(table_name,table_id,table_id_name,type,state) VALUES('d_shop',@shopid,'shopid',1,1)
end

3、删除触发器

复制代码
begin  
  set nocount on
	declare @shopid int  
	select @shopid = shopid from deleted;
	INSERT INTO dade(table_name,table_id,table_id_name,type,state) VALUES('d_shop',@shopid,'shopid',1,1)
end
相关推荐
jianghua0019 小时前
Django视图与URLs路由详解
数据库·django·sqlite
那我掉的头发算什么9 小时前
【Mybatis】Mybatis-plus使用介绍
服务器·数据库·后端·spring·mybatis
wazmlp0018873699 小时前
第五次python作业
服务器·开发语言·python
倔强的石头1069 小时前
关系数据库替换用金仓:数据迁移过程中的完整性与一致性风险
数据库·kingbase
_Johnny_9 小时前
ETCD 配额/空间告警模拟脚本
数据库·chrome·etcd
静听山水9 小时前
StarRocks查询加速
数据库
静听山水9 小时前
StarRocks高级特性
数据库
looking_for__9 小时前
【Linux】应用层自定义协议与序列化
linux·服务器·网络
唐梓航-求职中9 小时前
技术-算法-leetcode-1606. 找到处理最多请求的服务器(易懂版)
服务器·算法·leetcode
范纹杉想快点毕业9 小时前
从单片机基础到程序框架:全方位技术深度解析
数据库·mongodb