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
相关推荐
2401_8919573111 分钟前
简单了解多路转接select
运维·服务器
2302_11114 分钟前
java依赖小结
java·运维·数据库
听到微笑40 分钟前
Elasticsearch 如何存储与检索海量向量
数据库·elasticsearch
程序员-Benothing44 分钟前
Shell 脚本条件判断与流程控制:if for while case 详解
linux·运维·服务器
captain3761 小时前
网络原理(3)-TCP核心机制连接管理▲▲▲
java·服务器·网络·ide·网络协议·tcp/ip·java-ee
海浪仙人掌1 小时前
速动比率怎么分析?速动比率分析有哪些注意事项?
大数据·数据库·人工智能
企业数字化笔记1 小时前
固定资产历史数据怎么导入系统?Excel模板、字段映射和数据校验
android·java·数据库·后端
君生我老1 小时前
Linux动静态库
linux·服务器
troy1281 小时前
Python 基础语法(一):变量、数据类型与运算符
java·服务器·python
还是奇怪1 小时前
OpenAI GPT-5.6 构建指南拆解:创业公司如何用模型选择与 Responses API 降低 Agent 成本
java·数据库·人工智能·gpt