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資料型別之一,則返回二進位制資料。
示例
下例用xxx替換abcdefghi中的字串cde。
SELECTREPLACE(""abcdefghicde"",""cde"",""xxx"")GO
下面是結果集:
------------abxxxfghixxx(1row(s)affected)
--這是一些我曾經收集的資料
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資料型別之一,則返回二進位制資料。
示例
下例用xxx替換abcdefghi中的字串cde。
SELECTREPLACE(""abcdefghicde"",""cde"",""xxx"")GO
下面是結果集:
------------abxxxfghixxx(1row(s)affected)
--這是一些我曾經收集的資料