您当前的位置: 首页 >  sql

衣舞晨风

暂无认证

  • 0浏览

    0关注

    1156博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Sql Server REPLACE函数

衣舞晨风 发布时间:2014-05-15 09:30:33 ,浏览量:0

Replaces all occurrences of a specified string value with another string value. 语法: REPLACE ( string_expression , string_pattern , string_replacement ) 参数: string_expression Is the string expression to be searched. string_expression can be of a character or binary data type. string_pattern Is the substring to be found. string_pattern can be of a character or binary data type. string_pattern cannot be an empty string (''), and must not exceed the maximum number of bytes that fits on a page. string_replacement Is the replacement string. string_replacement can be of a character or binary data type. 返回 Returns nvarchar if one of the input arguments is of the nvarchar data type; otherwise, REPLACE returns varchar. Returns NULL if any one of the arguments is NULL. If string_expression is not of type varchar(max) or nvarchar(max), REPLACE truncates the return value at 8,000 bytes. To return values greater than 8,000 bytes, string_expression must be explicitly cast to a large-value data type. 即用第三个表达式替换第一个字符串表达式中出现的所有第二个给定字符串表达式。

例子:

SELECT REPLACE('AAAAAXXXAAA','X','A');

结果:

 

 

关注
打赏
1647422595
查看更多评论
立即登录/注册

微信扫码登录

0.6869s