zoukankan      html  css  js  c++  java
  • Sql Server REPLACE函数的使用

    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。

    SELECT REPLACE(''abcdefghicde'',''cde'',''xxx'')GO
    下面是结果集:

    ------------abxxxfghixxx(1 row(s) affected)

    这个函数有一点不足是不支持 text,ntext类型字段的替换

  • 相关阅读:
    51nod1711 平均数
    51nod1204 Parity
    51nod1274 最长递增路径
    51nod1403 有趣的堆栈
    51nod1364 最大字典序排列
    bzoj1857: [Scoi2010]传送带
    bzoj3224: Tyvj 1728 普通平衡树
    bzoj2396: 神奇的矩阵
    bzoj2428: [HAOI2006]均分数据
    splay入门
  • 原文地址:https://www.cnblogs.com/remember-forget/p/5993526.html
Copyright © 2011-2022 走看看