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?
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?
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)
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.