Solved

Replace Function

Posted on 2012-04-12
7
196 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
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now