Using SQL Server 2005
Table1
ID
Abc0012
BED004开发者_StackOverflow中文版5
cAB0027
....
I want to replace all the ID values in the table1 like ABC0012, BED0045, CAB0027.
I want to make all characters as caps
Need Query Help
UPDATE Table1
SET ID = UPPER(ID)
Use the UPPER function
update table1 set id = upper(id)
Use upper
:
SELECT upper(ID) FROM YourTable
or:
UPDATE YourTable SET ID=upper(ID)
If you want to change them:
UPDATE
Table1
SET
ID = UPPER(ID)
Could work, this is untested though.
I believe you should be able to do something like this:
UPDATE Table1 SET ID = UPPER(ID)
Here's a complete script that shows how to use the UPPER() function to achieve this:
declare @mytable table (
somevalue varchar (20)
)
insert into @mytable(
somevalue
)
values (
'abc123'
)
insert into @mytable(
somevalue
)
values (
'xYz456'
)
insert into @mytable(
somevalue
)
values (
'gjriwe345'
)
update @mytable
set somevalue = upper(somevalue)
select *
from @mytable
精彩评论