?
Solved

Replace part of ntext field SQL

Posted on 2009-12-23
2
Medium Priority
?
345 Views
Last Modified: 2012-06-27
I used that code:

UPDATE CMRC_Products set Desc = replace(Cast(LongDesc AS NVARCHAR(Max)), '+ System.Configuration.ConfigurationManager.AppSettings["Domain"]+', '@mysite.com')

Its says row affected, but its not true... noting was changed!

So I want to change the part of the email address (@mysite.com) in the file to + System.Configuration.ConfigurationManager.AppSettings["Domain"]+'

Any help?
0
Comment
Question by:JustAskMe
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1000 total points
ID: 26115434
your replace structure in in the reverse order

UPDATE CMRC_Products set Desc = replace(Cast(LongDesc AS NVARCHAR(Max)), '@mysite.com','+ System.Configuration.ConfigurationManager.AppSettings["Domain"]+')
0
 
LVL 10

Assisted Solution

by:lof
lof earned 1000 total points
ID: 26115906
Hi,

that's what you are trying to do.
select REPLACE('abc@mysite.com', '@mydomain.com', '@mysite.com')

basically you look for yourdomain in the string and try to replace it with 'mysite.com'

and that's what you want to do:
select REPLACE('abc@mysite.com', '@mysite.com', '@mydomain.com')


0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

809 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