插入后创建触发器 [英] Create trigger after insert

查看:96
本文介绍了插入后创建触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表格中,除其他字段外,还有

In my table I have besides rest following fields

Email 
UpperEmail

我应该创建触发器,该触发器将在 UpperEmail 字段中填充电子邮件的值转换为大写字母。

I should create trigger which will populate UpperEmail field with Email value transformed to upper letters. How to do this?

推荐答案

我建议您创建一个计算列,而不是为UpperEmail创建单独的列,这个。有了计算列,您就不需要使用触发器。

Instead of having a separate column for UpperEmail, I would suggest that you create a computed column that does this. With a computed column, you would not need to use a trigger.

Ex:

Alter Table YourTableName Add UpperEmail As Upper(Email)

这篇关于插入后创建触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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