user1765862
user1765862

Reputation: 14145

Create trigger after insert

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?

Upvotes: 0

Views: 226

Answers (2)

Ben Thul
Ben Thul

Reputation: 32687

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.

Upvotes: 0

George Mastros
George Mastros

Reputation: 24498

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)

Upvotes: 6

Related Questions