Home > Archive > MS SQL Server > July 2005 > upper









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author upper
Fernand St-Georges

2005-07-11, 8:23 pm

How can I create a trigger that obliges UPPERCASE of a field in the
database?

thanks


Christoph Wienands

2005-07-11, 8:23 pm

In the trigger compare the actual value of the field to the UPPER(value). If
it's the same you can allow the insert or update, if it's not don't allow
it.

Christoph

"Fernand St-Georges" <fernand.st-georges@videotron.ca> wrote in message
news:b6CAe.46305$ZE5.994556@wagner.videotron.net...
> How can I create a trigger that obliges UPPERCASE of a field in the
> database?
>
> thanks
>



Dan Guzman

2005-07-12, 3:23 am

If you column collation is case-insensitive, you can force a case-sensitive
compare using an explicit collation via a COLLATE clause. Personally, I'd
use a CHECK constraint rather than a trigger: For example:

ALTER TABLE MyTable
ADD CONSTRAINT CK_MyTable_Col1
CHECK (col1 = UPPER(Col1) COLLATE SQL_Latin1_General_C
P1_CS_AS)

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Fernand St-Georges" <fernand.st-georges@videotron.ca> wrote in message
news:b6CAe.46305$ZE5.994556@wagner.videotron.net...
> How can I create a trigger that obliges UPPERCASE of a field in the
> database?
>
> thanks
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com