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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to change from lower case to upper case

Author  Topic 

Kleber
Yak Posting Veteran

67 Posts

Posted - 2005-10-06 : 14:41:57
Hi all

I have a column in a table that has values like that 123456ab. I have few thousand rows, so, how may I change the "ab" to "AB", with less effort?

Best regards.
Kleber Gomes

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-06 : 14:50:42
UPDATE Table1 SET Column1 = UPPER(Column1)

Tara
Go to Top of Page

Kleber
Yak Posting Veteran

67 Posts

Posted - 2005-10-06 : 15:39:54
You are a life safer. Thanks milady.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-07 : 00:53:25

Or

Let it as it is and Show it as Upper case when you select it

Select Upper(col) from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-07 : 01:53:11
If its a large table, and not all of them will change, I would be inclined to only UPDATE the rows that will change:

UPDATE Table1
SET Column1 = UPPER(Column1)
WHERE Column1 IS NOT NULL
AND Column1 COLLATE Latin1_General_BIN <> UPPER(Column1)

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-07 : 01:56:38
>>Column1 COLLATE Latin1_General_BIN <> UPPER(Column1)

What does it mean?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2005-10-07 : 02:01:48
>>What does it mean?

Look up collation in Books OnLine



Duane.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-07 : 02:30:41
>>Column1 COLLATE Latin1_General_BIN <> UPPER(Column1)

It forces the collation of Column1 to Binary, which then means that the expression is treated as "case sensitive"

For example:

SELECT CASE WHEN 'aaa' = 'AAA' THEN 1 ELSE 0 END,
CASE WHEN 'aaa' COLLATE Latin1_General_BIN = 'AAA' THEN 1 ELSE 0 END

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-07 : 02:40:18
Thanks Kristen

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -