您的位置:首页 > 博客中心 > 数据库 >

SQL_去掉字符串当中的字符

时间:2022-03-14 00:35

declare @myStr nvarchar(50)
set @myStr = ‘this is my world‘
print @myStr
print REPLACE(@myStr,‘world‘,‘word‘)

ps:REPLACE用法

语法
REPLACE ( "string_replace1" , "string_replace2" , "string_replace3" )
参数
"string_replace1"
待搜索的字符串表达式。string_replace1 可以是字符数据或二进制数据。
"string_replace2"
待查找的字符串表达式。string_replace2 可以是字符数据或二进制数据。
"string_replace3"
替换用的字符串表达式。string_replace3 可以是字符数据或二进制数据。
返回类型
如果 string_replace(1、2 或 3)是支持的字符数据类型之一,则返回字符数据。如果 string_replace(1、2 或 3)是支持的 binary 数据类型之一,则返回二进制数据。

热门排行

今日推荐

热门手游