I want to update every row in my table from upper case to lower case. I searched everywhere but could not found relevant answer. I dont want it to select using SELECT
. I would like to alter permanently may be using ALTER
.
I am using SQL server 2008.
Thanks.
Asked
Active
Viewed 5.0k times
9

M--
- 25,431
- 8
- 61
- 93
-
I doubt that you've "searched everywhere". The first google hit yields [`LOWER`](http://msdn.microsoft.com/en-us/library/ms174400.aspx). What i have used as keywords? The title of _your_ question. – Tim Schmelter Sep 28 '14 at 19:14
-
possible duplicate of [SQL changing a value to upper or lower case](http://stackoverflow.com/questions/341338/sql-changing-a-value-to-upper-or-lower-case) – Tim Schmelter Sep 28 '14 at 19:17
-
but that are were irrelevant as i want to change for my whole tablee.. there are several responses in google. And by the way google result changes with respect to the location may be you have got the correct result.. please share with me – Sep 28 '14 at 19:19
-
You know what _change_ in sql means? You don't want to change the type of a column but to _update_ the values. – Tim Schmelter Sep 28 '14 at 19:19
-
no i dont really know about change.. i am a newbie – Sep 28 '14 at 19:21
3 Answers
27
UPDATE table_name SET col1 = LOWER(col1), col2 = LOWER(col2), col3 = LOWER(col3);
HTH
Edit: Updating multiple columns. Just keep on adding columns like above. There is no direct automated way to update all the columns with a single command. Well, technically it may be possible using cursors
, but I would advise against it since this looks like a one time process and you are better off with writing a command once and for all.

Harsh Gupta
- 4,348
- 2
- 25
- 30
-
but this will update a single column.. Please re read my question. As i have written that how to change the upper lower case for the whole table and not only for single column.. Your quick response is appreciated SIR. – Sep 28 '14 at 19:15
-
As SQL statement dont have a `WHERE` clause, all table will be updated. – Camille Sep 13 '18 at 11:22
1
There's the LOWER
function. You'll need to UPDATE
your table:
UPDATE mytable SET charfld1=LOWER(charfld1), charfld2=LOWER(charfld2), ...
Put all your textual fields after the SET
.

zmbq
- 38,013
- 14
- 101
- 171
-
-
2Just replace charfld1 with the name of your first text column, charfld2 with the name of your second, etc... – zmbq Sep 28 '14 at 19:25