Create trigger after insert

我与影子孤独终老i 提交于 2019-12-25 02:24:52

问题


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?


回答1:


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)



回答2:


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.



来源:https://stackoverflow.com/questions/14819871/create-trigger-after-insert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!