Solved

replace, text datatype

Posted on 2010-08-27
4
255 Views
Last Modified: 2012-08-13
in table1
column1
replace
'\\\\'
with
''

datatype is text, so this does not work

UPDATE table1
SET column1 = REPLACE(column1, '\\\\', '')
WHERE CHARINDEX('\\\\', column1) > 0
0
Comment
Question by:rgb192
  • 2
4 Comments
 
LVL 4

Expert Comment

by:avarmaavarma
ID: 33544779
Try using a LIKE in your where clause

UPDATE table1
SET column1 = REPLACE(column1, '\\\\', '')
WHERE column1 LIKE '%\\\\%'
0
 
LVL 4

Accepted Solution

by:
MSSystems earned 500 total points
ID: 33544788
Try this
UPDATE table1

SET column1 = REPLACE(cast(column1 as varchar(20)), '\\\\', '')

WHERE CHARINDEX('\\\\', column1) > 0 

Open in new window

0
 
LVL 4

Expert Comment

by:MSSystems
ID: 33544942
avarmaavarma:
I the replace function will work against a text data type. I am sure there are other ways, but I think you have to use the UPDATETEXT function for NTEXT Data Types.

0
 

Author Closing Comment

by:rgb192
ID: 33545657
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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sql query help 7 82
sql calculate reminders 11 56
SQL help 5 47
Move SQL 2005 Express to Server 2012R2 19 72
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 I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

12 Experts available now in Live!

Get 1:1 Help Now