按照指定字符截取字符串,截取出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))

查出来有三处不一致

步步为营-104-SQL语句(截取字符串)的更多相关文章

  1. sql 语句 截取字符串的两种方案

    方案一:使用内置的函数 SUBSTRING,CHARINDEX,LEN三个内置函数 理论: SUBSTRING语法   SUBSTRING ( value_expression , start_exp ...

  2. sql语句截取字符串

    Postgresql 当中有四种方式获取当前时间.  一:now()      通过now()获取的时间是最完整的时间,包括时区,秒也保留到了6位小数.      select now();     ...

  3. SQL Server截取字符串

    --SQL Server截取字符串 , Len('hello@163.com')) ,charindex('.','hello@163.com'))

  4. 在论坛中出现的比较难的sql问题:1(字符串分拆+行转列问题 SQL遍历截取字符串)

    原文:在论坛中出现的比较难的sql问题:1(字符串分拆+行转列问题 SQL遍历截取字符串) 最近,在论坛中,遇到了不少比较难的sql问题,虽然自己都能解决,但发现过几天后,就记不起来了,也忘记解决的方 ...

  5. mysql里面如何用sql语句让字符串转换为数字

    sql语句将字符串转换为数字默认去掉单引号中的空格,遇到空格作为字符串截止, SELECT '123 and 1=1' +0 结果为123 MySQL里面如何用sql语句让字符串的‘123’转换为数字 ...

  6. SQL注入截取字符串函数

    在sql注入中,往往会用到截取字符串的问题,例如不回显的情况下进行的注入,也成为盲注,这种情况下往往需要一个一个字符的去猜解,过程中需要用到截取字符串.本文中主要列举三个函数和该函数注入过程中的一些用 ...

  7. Sql注入截取字符串常用函数

    在sql注入中,往往会用到截取字符串的问题,例如不回显的情况下进行的注入,也成为盲注,这种情况下往往需要一个一个字符的去猜解,过程中需要用到截取字符串.本文中主要列举三个函数和该函数注入过程中的一些用 ...

  8. SQL Server截取字符串和处理中文技巧

    一 环境介绍 SQL  Server PRINT @@VERSION MicrosoftSQLServer2012-11.0.2100.60(X64) Feb10201219:39:15 Copyri ...

  9. sql 语句系列(字符串的遍历嵌入删除与统计)[八百章之第十一章]

    遍历字符串 我觉得首先要提出一个疑问: 一个数据库本身就是用于存储的,遍历字符串究竟有何意义? 先看如何实现的,毕竟sql service 是没有for循环,也没有loop和while的. selec ...

随机推荐

  1. Windows防火墙配置(允许某个网段和部分IP访问某个端口)

    1.win+R 2.gpedit.msc 3.计算机配置+Windows设置+安全设置+IP安全策略,在本地计算机 4.创建IP安全策略 5.配置IP筛选器列表.筛选器操作 6.分配 192.168. ...

  2. 2017-2018-2 20165325 实验一《Java开发环境的熟悉》实验报告

    一.Java开发环境的熟悉-1 1.实验要求: 0 参考实验要求: 1 建立"自己学号exp1"的目录 : 2 在"自己学号exp1"目录下建立src,bin等 ...

  3. 原生js的开发笔记

    1.基本的dom操作 var a=document.getElementById('ma1').innerHTML;/获取html代码 alert(document.getElementById('m ...

  4. 【VMware vSphere】详解VDP安装步骤

    [写在前面] 在介绍VDP安装步骤之前,建议先了解一下什么是VDP.学习不仅要知其然,还要知其所以然.附链接[运维]vSphere Data Protection简介 [具体步骤] 1,登录vCent ...

  5. dubbo源码分析10——服务暴露1_export()方法分析

    ServiceConfig类中的export()方法,是dubbo服务暴露的入口方法,被触发的时机有两个: 1. spring容器初始化完成所有的bean实例后,通过事件机制触发 2. 实现Initi ...

  6. awk入门【转】

    awk其实不仅仅是工具软件,还是一种编程语言.不过,本文只介绍它的命令行用法,对于大多数场合,应该足够用了. 一.基本用法 awk的基本用法就是下面的形式. # 格式 $ awk 动作 文件名 # 示 ...

  7. SeaJS:一个适用于 Web 浏览器端的模块加载器

    什么是SeaJS?SeaJS是一款适用于Web浏览器端的模块加载器,它同时又与Node兼容.在SeaJS的世界里,一个文件就是一个模块,所有模块都遵循CMD(Common Module Definit ...

  8. MinGW GCC 7.3.0 2018年1月25日 出炉啦

    GCC_7.3.0._for_MSYS2.7z for x86 x64 63.68 MB发布日期: 2018-01-26 下载地址: https://forum.videohelp.com/attac ...

  9. 通过uwsgi+nginx启动flask的python web程序

    通过uwsgi+nginx启动flask的python web程序 一般我们启动python web程序的时候都是通过python直接启动主文件,测试的时候是可以的,当访问量大的时候就会出问题pyth ...

  10. 生产环境elasticsearch5.0报错IllegalArgumentException: number of documents in the index cannot exceed 2147483519的处理

    最近几天的push:user:req数据写不到集群,报错如下: [--13T09::,][DEBUG][o.e.a.b.TransportShardBulkAction] [yunva_etl_es8 ...