Create trigger after insert

2019-08-26 05:36发布

In my table I have besides rest following fields

Email 
UpperEmail

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

2条回答
爷、活的狠高调
2楼-- · 2019-08-26 05:50

As an alternative solution, have you thought about storing your e-mail addresses in a column with a case-insensitive collation? I ask because when I see someone caring about UPPER(value) or LOWER(value), it's so they can compare in a case-insensitive manner.

查看更多
我想做一个坏孩纸
3楼-- · 2019-08-26 06:11

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)
查看更多
登录 后发表回答