Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Good morning,Being a newbie to SQL, I would like your advise on how to write a simple trigger to make sure, that after inserting a row in a table, certain fields of the row inserted would be changed to upper case. Thanks very much in advance.
Kristen
Test
22859 Posts
Posted - 2005-10-27 : 04:34:35
Hi mbrijun, Welcoem to SQL Team!Untested, but try this:
CREATE TRIGGER MyTriggerON MyTableAFTER INSERT, UPDATEASUPDATE USET MyColumnA = UPPER(MyColumnA), MyColumnB = UPPER(MyColumnB)FROM MyTable U JOIN inserted AS I ON I.MyPrimaryKey = U.MyPrimaryKeyGO