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
相关推荐
IT大白鼠4 分钟前
MySQL 分布式集群系列 · 第七篇——生产调优实战:NDB 性能、内存、高可用全方位优化
数据库·分布式·mysql
IvorySQL5 分钟前
打造下一代 AI Agent 的统一多模智能数据底座——PostgreSQL 与 AI 的融合演进
数据库·人工智能·postgresql
ShineWinsu6 分钟前
对于MySQL:内置函数的解析
linux·数据库·c++·mysql·面试·函数·查询
isNotNullX13 分钟前
智能问数为什么答不准?数据、语义、模型、SQL四层拆解
数据库
新时代牛马37 分钟前
Linux 磁盘管理:分区、文件系统、挂载与扩容
linux·运维·服务器
weixin_402486341 小时前
VS Code Codex/Claude Extension 无法安装 / 无法正常打开
linux·服务器·vscode
大树881 小时前
液冷系统的真正瓶颈,藏在那层不到1毫米的材料里
大数据·运维·服务器·人工智能·ai
深念Y1 小时前
iOS模拟器在无Metal的NVIDIA显卡环境下的可行性研究报告
服务器·ios·unix·pve·freebsd
烂蜻蜓1 小时前
Django入门教程(三):django-admin与manage.py命令完全指南
数据库·django·sqlite
网硕互联的小客服2 小时前
没有公网IP,如何让外网访问内网服务器?
运维·服务器