Solved

replace, text datatype

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

912 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

28 Experts available now in Live!

Get 1:1 Help Now