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
相关推荐
IronMurphy1 分钟前
Redis拷打第三讲
数据库·redis·mybatis
楠枬11 分钟前
Redis 哨兵
数据库·redis
arronKler12 分钟前
数据库设计三大范式
数据库·oracle
敲代码的嘎仔27 分钟前
力扣高频SQL基础50题详解
开发语言·数据库·笔记·sql·算法·leetcode·后端开发
jran-36 分钟前
MySQL多表操作 查询&子查询&外键约束
数据库·mysql
hweiyu0037 分钟前
Linux命令:ip6tables
linux·运维·服务器
橙子圆12337 分钟前
Redis知识6之事务
数据库·redis·缓存
不会摸鱼的小鱼41 分钟前
WSL 安装 Ubuntu 22.04 到指定磁盘
数据库·postgresql·php
m0_702036531 小时前
mysql如何导出特定条件的查询数据_使用mysqldump加where参数
jvm·数据库·python
正在走向自律1 小时前
标量子查询消除:数据库优化器的一场“等价变戏法”
数据库·sql 优化·金仓数据库·数据库性能调优·标量子查询·数据库优化器