我有一个SQL Server数据库。有些列用逗号分隔。我的任务是从列中删除那些逗号。仅特定列,而不是全部。
t1 t2 t3 t4 t5
0 2,3 1,5 1,12 2,12
5 5,4 1,1 1,01 1,1
0 0,15 1,3 1,01 2,3
0,55 1,10 3,10 1,2 1,9
0,12 0,15 0,99 1,8 1,7
就像我只想从t1,t2和t3中删除逗号(,)。
答案 0 :(得分:3)
使用replace():
update tablename
set
t1 = replace(t1, ",", ""),
t2 = replace(t2, ",", ""),
t3 = replace(t3, ",", "")
where t1 like '%,%' or t2 like '%,%' or t3 like '%,%'