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
相关推荐
云贝教育-郑老师4 分钟前
【OceanBase OBCE V3.0认证】
数据库·oceanbase
深耕AI43 分钟前
【wordpress系列教程】02 Blocksy主题
运维·服务器·前端
思成不止于此2 小时前
【MySQL 零基础入门】DDL 核心语法全解析:数据库与表结构操作篇
数据库·笔记·学习·mysql
aspirestro三水哥2 小时前
2.5构建Xenomai测试与演示镜像
数据库·rtos·xenomai
随机昵称_1234562 小时前
postgresql连接报错Invalid SCRAM client initialization
数据库·postgresql
gaize12132 小时前
服务器异常如何解决
运维·服务器
编程饭碗2 小时前
【Java循环】
java·服务器·算法
dragoooon343 小时前
仿muduo库实现高并发服务器-面试常见问题
运维·服务器·面试
Fuly10243 小时前
langchain基础教程(6)---构建知识库--②向量数据库-milvus
数据库·langchain·milvus
TDengine (老段)3 小时前
TDengine IDMP 产品路线图
大数据·数据库·人工智能·ai·时序数据库·tdengine·涛思数据