Solved

Replace Function

Posted on 2012-04-12
7
199 Views
Last Modified: 2012-04-12
Experts-

I am trying to replace any "<br>" that is returned from my query.  Can someone help me with the replace function because it doesn't seem that I have it correct.....

     select *
    from prospectsNickTemp
    where homeownerNames Like '%<br>%'
    or agentNotes Like '%<br>%'
    or notes Like '%<br>%'

The update that I am trying to use but breaks is....

UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br>', ' ')
        WHERE id = #id#

Can someone tell me what I am doing wrong.

Thanks
Nick
0
Comment
Question by:nmarano
[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
  • 4
  • 2
7 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37839012
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br>', ' ')
--  why do you need this?        WHERE id = #id#
0
 
LVL 2

Author Comment

by:nmarano
ID: 37839027
where id = #id# is the query running within coldfusion, but if I can just do it in enterprise manager query that would work also
0
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37839089
nothing is wrong..
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 2

Author Comment

by:nmarano
ID: 37839205
SO I do have it working, but one question.  How can it is currently leaving a space where the replace is happening,
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br>', '')

I removed the space in my single quotes, but it shows a space in the table.  Any suggestions?

Thanks
Nick
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37839283
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br>', '')


You either have a space before or after the <br> which what you're seeing.

You may want to run 3 update statements:


--remove space after
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br> ', '')

--remove space before
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, ' <br>', '')

--remove no space.
UPDATE prospectsNickTemp
        SET homeownerNames = REPLACE(homeownerNames, '<br>', '')
0
 
LVL 2

Author Comment

by:nmarano
ID: 37839290
got you!  Thanks ged!
0
 
LVL 2

Author Closing Comment

by:nmarano
ID: 37839402
Thanks for helping me get rid of the spaces!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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