SQL method to replace repeating blanks with single blanks

前端 未结 15 2045
既然无缘
既然无缘 2020-12-01 17:52

Is there a more elegant way of doing this. I want to replace repeating blanks with single blanks....

   declare @i int

    set @i=0
    while @i <= 20
           


        
15条回答
  •  心在旅途
    2020-12-01 18:45

    WHILE
     (SELECT count(myIDcolumn) 
      from myTable where myTextColumn like '%  %') > 0
    BEGIN
      UPDATE myTable 
      SET myTextColumn = REPLACE(myTextColumn ,'  ',' ')
    END
    

提交回复
热议问题