| |

VerySource

 Forgot password?
 Register
Search
View: 2925|Reply: 14

Comma to filter out all data in a column

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-24 08:30:02
| Show all posts |Read mode
A table in the database, the data stored in a column is 1, 2, 3, how to change all data in the column to 123
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-5-7 08:30:01
| Show all posts
select replace ('1, 2, 3', ',', '')
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-5-7 10:00:01
| Show all posts
select repalce ('1,2,3 ,,', ',', '')
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 United States

Post time: 2020-5-7 12:45:01
| Show all posts
--Inquire
select replace (column_name, ',', '') from tablename
--Update
update tablename set column_name = replace (column_name, ',', '')
Reply

Use magic Report

0

Threads

40

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-5-11 14:15:01
| Show all posts
Note whether it is Chinese comma or English.

select replace ('1, 2, 3', ',', '') from table


update table set column = replace (column, ',', '')
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 United States

Post time: 2020-5-11 15:15:01
| Show all posts
Just replace this function
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Unknown

Post time: 2020-5-11 21:30:01
| Show all posts
-Full-width half-width, all can be removed
declare @a varchar (10)
set @ a = '1, 2, 3 ,,'
select replace (@a, ',', '')
-------------------
123

(The number of rows affected is 1 row)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-15 08:30:02
| Show all posts
- Full-width half-width, all can be removed
declare @a varchar(10)
set @a='1, 2, 3,,'
select replace(@a,',','')
-------------------
123

(The number of rows affected is 1 row)
——————————————————————
fart! ! ! Of course, it must be divided into half-width! ! ! What is your SQL? So powerful?
Reply

Use magic Report

0

Threads

126

Posts

73.00

Credits

Newbie

Rank: 1

Credits
73.00

 China

Post time: 2020-6-16 13:15:01
| Show all posts
select replace(replace('1,2,3,4',',',''),',','')
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-6-18 11:15:02
| Show all posts
to:chyg2008

Don’t talk like that

The above is the test result will not look at home to eat shit
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list