SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to change from lower case to upper case
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kleber
Yak Posting Veteran

Brazil
67 Posts

Posted - 10/06/2005 :  14:41:57  Show Profile  Reply with Quote
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

USA
36674 Posts

Posted - 10/06/2005 :  14:50:42  Show Profile  Visit tkizer's Homepage  Reply with Quote
UPDATE Table1 SET Column1 = UPPER(Column1)

Tara
Go to Top of Page

Kleber
Yak Posting Veteran

Brazil
67 Posts

Posted - 10/06/2005 :  15:39:54  Show Profile  Reply with Quote
You are a life safer. Thanks milady.
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 10/07/2005 :  00:53:25  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote

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

United Kingdom
22403 Posts

Posted - 10/07/2005 :  01:53:11  Show Profile  Reply with Quote
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

India
22744 Posts

Posted - 10/07/2005 :  01:56:38  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
>>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
Flowing Fount of Yak Knowledge

South Africa
1466 Posts

Posted - 10/07/2005 :  02:01:48  Show Profile  Visit ditch's Homepage  Reply with Quote
>>What does it mean?

Look up collation in Books OnLine



Duane.
Go to Top of Page

Kristen
Test

United Kingdom
22403 Posts

Posted - 10/07/2005 :  02:30:41  Show Profile  Reply with Quote
>>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

India
22744 Posts

Posted - 10/07/2005 :  02:40:18  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Thanks Kristen

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000