Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

replace, text datatype

Posted on 2010-08-27
4
Medium Priority
?
262 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
[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 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 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