Sql Server中REPLACE函數(shù)的使用
REPLACE
用第三個表達式替換第一個字符串表達式中出現(xiàn)的所有第二個給定字符串表達式。
語法
REPLACE ( ''string_replace1'' , ''string_replace2'' , ''string_replace3'' )
參數(shù)
''string_replace1''
待搜索的字符串表達式。string_replace1 可以是字符數(shù)據(jù)或二進制數(shù)據(jù)。
''string_replace2''
待查找的字符串表達式。string_replace2 可以是字符數(shù)據(jù)或二進制數(shù)據(jù)。
''string_replace3''
替換用的字符串表達式。string_replace3 可以是字符數(shù)據(jù)或二進制數(shù)據(jù)。
返回類型
如果 string_replace(1、2 或 3)是支持的字符數(shù)據(jù)類型之一,則返回字符數(shù)據(jù)。如果 string_replace(1、2 或 3)是支持的 binary 數(shù)據(jù)類型之一,則返回二進制數(shù)據(jù)。
示例
下例用 xxx 替換 abcdefghi 中的字符串 cde。
SELECT REPLACE(''abcdefghicde'',''cde'',''xxx'')GO
下面是結(jié)果集:
------------abxxxfghixxx(1 row(s) affected)
版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。