按照指定字符截取字符串,截取出300

业务需求:想比对图片中框线部分是否一致

第一步 从最后一个/截取到末尾

select top 1 reverse(substring(reverse(ProcessControlName),1,charindex('/',reverse(ProcessControlName)) - 1)) from ProcessPublish;

--第二步 在第一步的基础上从最后一个.截取
select RTRIM(LTRIM(reverse(substring(reverse(ProcessControlName),1,charindex('/',reverse(ProcessControlName)) - 1)))) as web端模板,RTRIM(LTRIM(reverse(substring(reverse(MobileFormTemplatePath),1,charindex('/',reverse(MobileFormTemplatePath)) - 1)))) as 手机端模板, *
from ProcessPublish
where ProcessID >2489 --新增加的"华济建设"
and ProcessControlName != '' --模板不等于空,说明bpm发起的
and MobileFormTemplatePath != ''

--第三步 在第二步的基础上获取去掉.html字段
select top 1 (substring((substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName)))),1,charindex('/',(substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName))))) - 1)) from ProcessPublish

最后,完成

select (substring((substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName)))),1,charindex('/',(substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName))))) - 1)) as web端模板,
(substring((substring(reverse(MobileFormTemplatePath),charindex('.',reverse(MobileFormTemplatePath))+1,len(reverse(MobileFormTemplatePath))-charindex('.',reverse(MobileFormTemplatePath)))),1,charindex('/',(substring(reverse(MobileFormTemplatePath),charindex('.',reverse(MobileFormTemplatePath))+1,len(reverse(MobileFormTemplatePath))-charindex('.',reverse(MobileFormTemplatePath))))) - 1)) as 手机端模板, *
from ProcessPublish
where ProcessID >2489 --新增加的"华济建设"
and ProcessControlName != '' --模板不等于空,说明bpm发起的
and MobileFormTemplatePath != ''
and (substring((substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName)))),1,charindex('/',(substring(reverse(ProcessControlName),charindex('.',reverse(ProcessControlName))+1,len(reverse(ProcessControlName))-charindex('.',reverse(ProcessControlName))))) - 1)) != (substring((substring(reverse(MobileFormTemplatePath),charindex('.',reverse(MobileFormTemplatePath))+1,len(reverse(MobileFormTemplatePath))-charindex('.',reverse(MobileFormTemplatePath)))),1,charindex('/',(substring(reverse(MobileFormTemplatePath),charindex('.',reverse(MobileFormTemplatePath))+1,len(reverse(MobileFormTemplatePath))-charindex('.',reverse(MobileFormTemplatePath))))) - 1))

查出来有三处不一致

转载于:https://www.cnblogs.com/YK2012/p/9291031.html

步步为营-104-SQL语句(截取字符串)相关推荐

  1. 小黑小波比.sql语句截取字符串的子串

    2019独角兽企业重金招聘Python工程师标准>>> 1.当参数值1112324312423,在表中有11代表北京1101代表东城110105代表街道.所以要根据参数查出完整的地区 ...

  2. sql中截取字符串函数_SQL Server 2017中的顶级SQL字符串函数

    sql中截取字符串函数 SQL Server 2017 has been in the talk for its many features that simplify a developer's l ...

  3. mysql语句+截取字符串_MySQL 截取字符串函数的sql语句

    1.left(name,4)截取左边的4个字符 列: select left(201809,4) 年 结果:2018 2.right(name,2)截取右边的2个字符 select right(201 ...

  4. mysql下SQL注入截取字符串常用函数mid(),substr(),left()

    在sql注入中,往往会用到截取字符串的问题,例如不回显的情况下进行的注入,也成为盲注,这种情况下往往需要一个一个字符的去猜解,过程中需要用到截取字符串 mid函数 此函数为截取字符串一部分.MID(c ...

  5. sql语句之字符串截取(substring_index)

    一.substring_index: 实现提取表单列表中的字符串 来源:https://www.cnblogs.com/mqxs/p/7380933.html 1.格式: substring_inde ...

  6. SQL语句中将字符串转换为时间格式

    字符串  datetext="2005-10-10" SQL Server/MYSQL中: cast('2005-10-10' as datetime) 如:select * fr ...

  7. SQL Server截取字符串函数操作

    1.SUBSTRING()函数 含义:从指定位置开始截取指定数量的字符. 使用:SUBSTRING(原字符,截取字符的起始位置,截取字符数量) 举例: 1.截取字符的起始位置是从1开始的,为0的话截取 ...

  8. Excel使用公式截取字符串

    例如一个文件列表: E:\Nginx\nginx\trunk\src\core\nginx.c E:\Nginx\nginx\trunk\src\http\ngx_http.c E:\Nginx\ng ...

  9. MS-SQL Server 基础类 - SQL语句

      网址收藏夹 免费申请! 首页 |收藏夹 | 笑话 | 贴吧 | 交友 | 留言 | 软件 | 超市 | 网页特效 | 酷站导航 | 论坛 新闻 | 同学录 | 图片 | 跑商 | 动画 | 音乐 ...

最新文章

  1. Globalization Resources
  2. Django之ModelForm验证
  3. SD-WAN — 云专线(企业入云)
  4. Asp.Net的控件如何与Server交互
  5. 32位 shell.efi x86_Linux 的 32 位内核自 Meltdown 以来一直有问题
  6. Liunx下使用Nginx负载均衡
  7. python怎么把excel单元格里面的文字提取出来_干货 | Excel如何花式秀操作?
  8. QT创建相应文件夹在指定目录下
  9. Android:自定义滚动边缘(EdgeEffect)效果
  10. h3c等价路由(rip)
  11. Oracle数据把持和控制言语详解-1
  12. netscreen MIP 问题
  13. vue ajax 上传,vue中用ajax上传文件
  14. 概括计算机程序启动过程,计算机启动过程详解
  15. 十次方——父工程子模块、公共模块
  16. 发票管理小工具(三):PDFMiner vs pdfminer3k vs Pdfminer.six
  17. PC上测试移动端网站和模拟手机浏览器
  18. cropper:图片裁剪工具
  19. java字节流与字符流的区别编码缓冲
  20. java 上传图片与图片读取

热门文章

  1. 以高效节能为使命 绿色数据中心势在必行
  2. win 8升级win8.1的几个问题
  3. ASP.NET MVC WebAPI 资源整理
  4. Mysql学习总结(41)——MySql数据库基本语句再体会
  5. error: jump to label ‘XXXX’ [-fpermissive]
  6. Linux程序包管理,YUM命令使用解析。
  7. Centos设置静态IP及修改Centos配置文件
  8. Android:手把手教你 实现Activity 与 Fragment 相互通信(含Demo)
  9. 好好学习网--2009年十大新兴企业技术:MapReduce折桂
  10. windows terminal 笔记