我如何在SQL Server中更新之前编写触发器 [英] How I write trigger before update in SQL server

查看:210
本文介绍了我如何在SQL Server中更新之前编写触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有table1: - 代码:姓名:年龄:电话:更新用户:日期

1:姓名1:25:01231:



和我有更新之前保存旧值的表格:



table2:代码:姓名:年龄:电话:更新用户:日期

1 :姓名1:25:01231:



我尝试过:



i想要从我的程序更新值时触发器保存table2中的旧值然后更新表1中的值

解决方案

读取:sql - 触发插入旧值 - 已更新的值 - Stack Overflow [ ^ ]

i have table1:- Code : Name : age : Phone : UpdateUser : Date
1 : Name1 : 25 : 01231 :

and i have table that save old value before update :

table2 : Code : Name : age : Phone : UpdateUser : Date
1 : Name1 : 25 : 01231 :

What I have tried:

i want when i update value from my program the trigger save old values in table2 and then update value in table 1

解决方案

Read this: sql - Trigger insert old values- values that was updated - Stack Overflow[^]


这篇关于我如何在SQL Server中更新之前编写触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆