?
Solved

column level trigger

Posted on 2011-10-07
2
Medium Priority
?
287 Views
Last Modified: 2012-05-12
is it possible to say to the column that whenever it is updated, it should save the text in UPPER case only?
0
Comment
Question by:25112
2 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 2000 total points
ID: 36934484
You can certainly create a TRIGGER on the table to do that, as in:
CREATE TRIGGER trg_YourTrigger ON YourTableName
FOR UPDATE
AS

IF UPDATE(YourColumnName)
   UPDATE t
   SET  YourColumnName = UPPER(YourColumnName)
   FROM	YourTableName t
		INNER JOIN INSERTED i ON t.YourPrimaryKeyGoesHere = i.YourPrimaryKeyGoesHere

Open in new window

0
 
LVL 5

Author Comment

by:25112
ID: 36936542
ok
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question