Groups | Blog | Home
all groups > sql server mseq > august 2003 >

sql server mseq : Conditional Update


Mike T.
8/27/2003 12:47:00 PM
Hello,

I have SQL7 and need to convert the contents of a field to
upper case. However, I do not want to simply issue the
following statement due to the number of rows:

UPDATE <table> SET <field> = UPPER(<field>)

So, I tried the following in an effort to cause the
minimal number of transactions in the log file:

UPDATE <table> SET <field> = UPPER(<field>)
WHERE <field> <> UPPER(<field>)

Unfortunately, this statement affects zero rows, because
it is evaluating <field> = UPPER(<field>) regardless
whether the contents of the field are already upper case
or not.

Any help to get SQL7 to distinguish the mixed case value
from the upper case value would be greatly appreciated.

Thank you,

Mike T.
Vishal Parkar
8/28/2003 4:14:02 AM
Try:

UPDATE <table> SET <field> = UPPER(<field>)
WHERE cast(<field> as binary(8)) <> cast(UPPER(<field>) as binary(8))

--
-Vishal

[quoted text, click to view]

AddThis Social Bookmark Button