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
相关推荐
dkbnull8 小时前
数据库性能调优详解
数据库·mysql
青峰客8 小时前
DeepSeek 大模型新手快速上手指南
运维·服务器·github
风哥2号8 小时前
数据库教程FGMT50‑PostgreSQL体系结构深入与源码解析
数据库·postgresql
ly76898 小时前
磁盘 I/O 延迟突增:用 iostat、blktrace 与火焰图定位到具体调用栈
java·linux·前端·数据库·iostat·磁盘 i/o·blktrace
倔强的石头_8 小时前
数据迁移工具KDMS如何生成量化评估报告
数据库
程序员-Benothing8 小时前
Linux查找文件命令:find、locate、which、whereis实战
linux·运维·服务器
冰暮流星8 小时前
mysql多表练习2
数据库·sql·mysql
天天喝旺仔8 小时前
Git 内部原理深度解析:从 blob/tree/commit 对象到 packfile 与垃圾回收
数据结构·数据库·git·算法·哈希
团子股股东峥哥8 小时前
day39-RHEL-访问网络附加存储
linux·运维·服务器
程序员-Benothing10 小时前
Linux文件查看与编辑:cat、less、tail、vim快速入门
linux·运维·服务器