• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2719
  • Last Modified:

SQL Server 2005 Replace string

I have a table col carrying a lot of text in each rrecord.

I have a query that identifies the things that are causing export problems (Like | or double spaces..etc)

How can I update the records to rreplace the data double spaces with one space?

select mls, completeDescription from properties where completeDescription like '%' + '  ' + '%' and active = '1'
0
lrbrister
Asked:
lrbrister
  • 2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
update Properies
set CompleteDescription = replace(CompleteInstruction, '  ',' ' )
where active  = 1
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
update properties
  set completeDescription  = replace(completeDescription , '  ', ' ')
where completeDescription like '%  %'
 and active = '1'
0
 
lrbristerAuthor Commented:
aneeshattingal: and angelII...
  I trust both you guys...which one is better from a data safety perspective?
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
both are exactly the same except in the  where part (Actually i missed the first condition, Angel's code is better  )
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now