REPLACE
用第三個(gè)表達(dá)式替換第一個(gè)字符串表達(dá)式中出現(xiàn)的所有第二個(gè)給定字符串表達(dá)式。
語法
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)
標(biāo)簽:陜西 通遼 廣安 阿里 南京 河北 馬鞍山 福建
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Sql Server中REPLACE函數(shù)的使用》,本文關(guān)鍵詞 Sql,Server,中,REPLACE,函數(shù),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。