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
相关推荐
xcLeigh9 分钟前
IoTDB JDBC 完整使用教程:连接、查询、批处理与字符集配置
开发语言·数据库·qt·iotdb·查询·批处理·连接
chunyublog10 分钟前
数据挖掘环境搭建
数据库
阿洛学长20 分钟前
CSDN、掘金、简书博客文章如何转为Markdown?
运维·数据库·架构·php·持续部署
方安乐22 分钟前
交换机的自学机制
运维·服务器·网络
zuozewei25 分钟前
国产化之达梦数据库性能优化方案
数据库·性能优化
Volunteer Technology1 小时前
Spring AI MCP 案例-WebFlux SSE传输模式 (九)
java·数据库·人工智能·spring
jieyucx1 小时前
Go 语言进阶:构造函数、父子结构体与组合复用详解
服务器·算法·golang·继承·结构体·构造函数
betazhou2 小时前
SQL server数据库镜像同步技术
数据库·sql server·高可用·数据库镜像
mpHH2 小时前
postgresql-分区表
数据库·postgresql