Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Server 2005 Replace string

Posted on 2007-11-14
4
Medium Priority
?
2,717 Views
Last Modified: 2008-02-01
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
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20280588
update Properies
set CompleteDescription = replace(CompleteInstruction, '  ',' ' )
where active  = 1
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20280630
update properties
  set completeDescription  = replace(completeDescription , '  ', ' ')
where completeDescription like '%  %'
 and active = '1'
0
 

Author Comment

by:lrbrister
ID: 20280974
aneeshattingal: and angelII...
  I trust both you guys...which one is better from a data safety perspective?
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20281022
both are exactly the same except in the  where part (Actually i missed the first condition, Angel's code is better  )
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question