需要帮助删除触发器

需要帮助删除触发器

本文介绍了需要帮助删除触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想创建删除触发器。想法是当用户从表触发器中删除记录时将此记录移动到另一个表(此表是副本具有相同的字段,类型)但是这一切我想做dinamic。我这样开始:I wanna create delete trigger. Idea is when user deletes the record from table trigger moves this record to another table (this table is copy has the same fields, types) But all this I want to do dinamic. I start so: 展开 | 选择 | Wrap | 行号推荐答案你的动态是什么意思? 您是否尝试动态传递tablename?What do you mean by dynamic ?Are you trying to pass tablename dynamically ? 动态是什么意思? 您是否尝试动态过去tablename?What do you mean by dynamic ?Are you trying to past tablename dynamically ? 是的。我生成字段设置@val = @val +'',[''+ @ fieldname +'']'' 但也需要值,然后我会在查询中粘贴变量,如 set @q =''INSERT INTO my_table(''+ @ val +'')VALUES(这里我有问题,我无法从表中删除带字段@fieldname的值)''Yes. I generated fields set @val = @val + '',[''+@fieldname + '']''but also need values and then I will paste variables in the query likeset @q = ''INSERT INTO my_table (''+@val+'') VALUES (here I have problem, I cant get values from table Deleted with field @fieldname)''现在我有Now I have 展开 | 选择 | Wrap | 行号 这篇关于需要帮助删除触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 20:53