T-SQL String replace in Update

I need help in updating the column values based upon the part of the data.

Example:

Data contains abc@domain1, pqr@domain2 etc. I need to update the values so that @domain2 should be replaced to @domain1

Thanks for the Help

Answers


The syntax for REPLACE:

REPLACE (string_expression,string_pattern,string_replacement)

So that the SQL you need should be:

UPDATE [DataTable] SET [ColumnValue] = REPLACE([ColumnValue], 'domain2', 'domain1')

Need Your Help

linking to boost libraries fails during compilation

c++ boost boost-asio dynamic-linking

I have a very simple example program that I am trying to compile, but I'm getting linking errors.

How to do a simple form-urlencoded POST request in AFNetworking 2.0?

ios networking afnetworking-2

How do I replicate this NSURLConnection code in AFNetworking 2.0?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.