Replace usage in T-SQL _ string replacement

Source: Internet
Author: User
Replace

Replace all the second given string expressions in the first string expression with the third expression.

Syntax

Replace('String_expression1','String_expression2','String_expression3')

Parameters

'String_expression1'

String expression to be searched.String_expression1It can be character data or binary data.

'String_expression2'

String expression to be searched.String_expression2It can be character data or binary data.

'String_expression3'

String expression used for replacement.String_expression3It can be character data or binary data.

Return type

IfString_expression(1, 2, or 3) is one of the supported character data types, then the return character data. IfString_expression(1, 2, or 3) is supportedBinaryIf it is one of the data types, binary data is returned.

Example

In the following example, replace the string CDE in abcdefghi with xxx.

 
Select Replace ('abcdefghicde', 'cde', 'xxx') Go

The following is the result set:

 
------------ Abxxxfghixxx (1 row (s) affected)

See

 

Data Type

String Functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.