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
相关推荐
爱学习的小囧14 分钟前
VCF 9.0+Harbor 搭建私有 AI 模型仓库(PAIS)超详细教程
服务器·人工智能·虚拟化·esxi8.0
百结21428 分钟前
PostgreSQL 初体验
数据库·postgresql
春日见1 小时前
Tool文件夹:瑞士军刀库
运维·服务器·windows·深度学习·自动驾驶
ward RINL1 小时前
Redis 安装及配置教程(Windows)【安装】
数据库·windows·redis
Gofarlic_OMS1 小时前
SolidEdge专业许可证管理工具选型关键评估标准
java·大数据·运维·服务器·人工智能
萝卜白菜。2 小时前
TongWeb7.0 集中管理heimdall配置文件说明
linux·运维·服务器
bingHHB2 小时前
金蝶云星空旗舰版 × 赛狐ERP:亚马逊卖家业财一体化的最后一公里
运维·数据库·集成学习
ji_shuke2 小时前
CloudFront 跨域问题(CORS)的几种解决方式
服务器·cloudfront
IMPYLH3 小时前
Linux 的 install 命令
linux·运维·服务器·bash
Nontee3 小时前
Redis高可用架构解析
数据库·redis·架构