共計(jì) 648 個(gè)字符,預(yù)計(jì)需要花費(fèi) 2 分鐘才能閱讀完成。
今天就跟大家聊聊有關(guān) Sql Server 中如何使用 REPLACE 函數(shù),可能很多人都不太了解,為了讓大家更加了解,丸趣 TV 小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
REPLACE
用第三個(gè)表達(dá)式替換第一個(gè)字符串表達(dá)式中出現(xiàn)的所有第二個(gè)給定字符串表達(dá)式。
語(yǔ)法
REPLACE (string_replace1 , string_replace2 , string_replace3)
參數(shù)
string_replace1
待搜索的字符串表達(dá)式。string_replace1 可以是字符數(shù)據(jù)或二進(jìn)制數(shù)據(jù)。
string_replace2
待查找的字符串表達(dá)式。string_replace2 可以是字符數(shù)據(jù)或二進(jìn)制數(shù)據(jù)。
string_replace3
替換用的字符串表達(dá)式。string_replace3 可以是字符數(shù)據(jù)或二進(jìn)制數(shù)據(jù)。
返回類型
如果 string_replace(1、2 或 3)是支持的字符數(shù)據(jù)類型之一,則返回字符數(shù)據(jù)。如果 string_replace(1、2 或 3)是支持的 binary 數(shù)據(jù)類型之一,則返回二進(jìn)制數(shù)據(jù)。
示例
下例用 xxx 替換 abcdefghi 中的字符串 cde。
SELECT REPLACE(abcdefghicde , cde , xxx)GO
下面是結(jié)果集:
————abxxxfghixxx(1 row(s) affected)
看完上述內(nèi)容,你們對(duì) Sql Server 中如何使用 REPLACE 函數(shù)有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注丸趣 TV 行業(yè)資訊頻道,感謝大家的支持。