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
相关推荐
m0_738120721 分钟前
渗透测试基础——一文详解JSONP跨域劫持漏洞原理与利用
服务器·安全·web安全·json
雪的季节3 分钟前
HTTP 和 HTTPS 五大核心区别
数据库·http·https
GottdesKrieges5 分钟前
OceanBase迁移用户及其权限配置
数据库·oceanbase
朗晴10 分钟前
Linux开机重置密码时做了什么?
linux·运维·服务器
OceanBase数据库官方博客21 分钟前
新版本 OceanBase seekdb 1.3.0:22倍性能增益,P99抖动小于1.1倍
数据库·oceanbase
倒流时光三十年21 分钟前
PostgreSQL ON CONFLICT DO UPDATE 增加 WHERE 条件优化性能
数据库·postgresql
暴力求解27 分钟前
MySQL---表的操作
数据库·mysql
itinymeng39 分钟前
在Alibaba Cloud Linux 4 LTS 64位 中安装htop
linux·运维·服务器
IvorySQL1 小时前
PostgreSQL 技术日报 (6月1日)|逻辑复制问题修复,AI 行业动态速览
数据库·人工智能·postgresql
Database_Cool_1 小时前
从 MySQL 迁移到阿里云 AnalyticDB MySQL:零改造百倍加速实战教程
数据库·mysql·阿里云