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
相关推荐
环流_14 小时前
redis中list类型
数据库·redis·list
MuYan~14 小时前
开发环境内网MySQL连接操作文档
运维·服务器
Bert.Cai14 小时前
Linux dirname命令详解
linux·运维·服务器
程序 代码狂人14 小时前
Linux查询自己环境的一些基础命令
linux·运维·服务器
aerror14 小时前
如何使用ubuntu搭建一个无盘PC启动服务器
linux·服务器·ubuntu
jiayong2314 小时前
Tool Permission 与 Sandbox 的安全流水线:Agent 工具系统的工程边界
java·数据库·安全·agent
weixin_4440129314 小时前
如何在MongoDB中实现按时间跨度的分片路由_时间序列范围分片与冷热节点架构
jvm·数据库·python
六月雨滴15 小时前
块(Block)管理
数据库·oracle·dba
东风破13715 小时前
DM存储过程及系统 表,系统视图,以及常规的运维SQL语句
运维·数据库·dm达梦数据库
CQU_JIAKE15 小时前
5.13【A】
数据库·sql