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.
Author |
Topic |
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2005-10-06 : 14:41:57
|
Hi allI 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 |
|
|
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2005-10-06 : 15:39:54
|
You are a life safer. Thanks milady. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-07 : 00:53:25
|
OrLet it as it is and Show it as Upper case when you select it Select Upper(col) from yourTableMadhivananFailing to plan is Planning to fail |
|
|
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 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-07 : 01:56:38
|
>>Column1 COLLATE Latin1_General_BIN <> UPPER(Column1)What does it mean?MadhivananFailing to plan is Planning to fail |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-07 : 02:01:48
|
>>What does it mean?Look up collation in Books OnLineDuane. |
|
|
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 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-07 : 02:40:18
|
Thanks Kristen MadhivananFailing to plan is Planning to fail |
|
|
|
|
|