Solved

replace, text datatype

Posted on 2010-08-27
4
258 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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