sql 查询包含字符的数量统计
DECLARE @word VARCHAR(2000);DECLARE @word VARCHAR(2000);
SELECT @word
= 'I do not like to get the news, because there has never been an era when so many things were going so right for so many of the wrong persons';
SELECT @word = REPLACE(@word, The_character, The_digit)
FROM (VALUES (2, 'A'), (2, 'B'), (2, 'C'), (3, 'D'), (3, 'E'), (3, 'F'), (4, 'G'), (4, 'H'), (4, 'I'), (5, 'J')
, (5, 'K'), (5, 'L'), (6, 'M'), (6, 'N'), (6, 'O'), (7, 'P'), (7, 'Q'), (7, 'R'), (7, 'S'), (8, 'T')
, (8, 'U'), (8, 'V'), (9, 'W'), (9, 'X'), (9, 'Y'), (9, 'Z')) mapping (The_digit, The_character);
SELECT @word AS TheTextVersion; DECLARE @word VARCHAR(2000);
SELECT @word
= 'I do not like to get the news, because there has never been an era when so many things were going so right for so many of the wrong persons';
SELECT @word = REPLACE(@word, The_character, The_digit)
FROM (VALUES (2, 'A'), (2, 'B'), (2, 'C'), (3, 'D'), (3, 'E'), (3, 'F'), (4, 'G'), (4, 'H'), (4, 'I'), (5, 'J')
, (5, 'K'), (5, 'L'), (6, 'M'), (6, 'N'), (6, 'O'), (7, 'P'), (7, 'Q'), (7, 'R'), (7, 'S'), (8, 'T')
, (8, 'U'), (8, 'V'), (9, 'W'), (9, 'X'), (9, 'Y'), (9, 'Z')) mapping (The_digit, The_character);
SELECT @word AS TheTextVersion; declare @test varchar(100);
select @test='hello,i love you';
select @test=REPLACE(@test,'i','ooo')
select @test declare @test1 varchar(100);
select @test1='ab aab aabb abb aba';
select @test1=REPLACE(@test1,b,a) from (values(1,'a'),(2,'b'))mapping(a,b)
select @test1 select * from (values(1,2),(3,4)) mapping(t,v)
sql 查询包含字符的数量统计的更多相关文章
- SQL查询包含汉字的行
1.查询字段首位为汉字 2.查询字段包含汉字(任意位) SELECT * FROM 表名 WHERE 字段 LIKE '%[吖-座]%' --[吖-座]是中文字符集第一个到最后一个的范围
- sql 查询替换字符
Select A,B,C from Tb1 –查询所有 Select A,replace(B,’1’,’壹’),C from Tb1 替换查询 Tb1 A B C AA1 1 CC A ...
- java面试题:如果一串字符如"aaaabbc中国1512"要分别统计英文字符的数量,中文字符的数量,和数字字符的数量,假设字符中没有中文字符、英文字符、数字字符之外的其他特殊字符。
package com.swift; public class TotalNumber_String { public static void main(String[] args) { /* * 如 ...
- Thinkphp查询 1.查询方式 2.表达式查询 3.快捷查询 4.区间查询 5.组合查询 6.统计查询 7.动态查询 8.SQL 查询
1.使用字符串作为条件查询 $user = M('User'); var_dump($user->where('id=1 AND user="蜡笔小新"')->sele ...
- SQL查询每个表的字段数量
--SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 ...
- Hibernate通过SQL查询常量时只能返回第一个字符的解决方法
在Hibernate中如果通过 [java] view plaincopy session.createSQLQuery("select '合计' as name from dual&quo ...
- Html input 限制输入中英文字符,及字符数量统计
margin:20px 0px 0px; font-family:Arial; color:rgb(51,51,51)"> 验证用户名的一个例子: html: <input ty ...
- Oracle常用SQL查询(2)
三.查看数据库的SQL 1 .查看表空间的名称及大小 select t.tablespace_name, round ( sum (bytes / ( 1024 * 1024 )), 0 ) ts ...
- 提高SQL查询效率(SQL优化)
要提高SQL查询效率where语句条件的先后次序应如何写 http://blog.csdn.net/sforiz/article/details/5345359 我们要做到不但会写SQL,还要做到 ...
随机推荐
- C++ 转型
1.const_static的使用场景:接收一个const对象,但是想改变对象内容,使用const_static去除对象的常量性,然后可以修改对象. 2.dynamic_static的使用场景:从子类 ...
- hdu 3339 In Action 背包+flyod
In Action Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=333 ...
- phpmyadmi 上传大文件
最近自己想通过phpmyadmin上传大的文件,找了很多方法都没搞定,今天特意静下心来,终于搞定了. 需求:将480M大小的sql文件通过phpmyadmin进行导入 1.首先修改php.ini文件, ...
- 关于View端
View--------------Request 1 URL vs n View 同一个URL可以对应多个View, HTML(通过Request请求获得) 例如SAO项目中的step1--> ...
- [Angular2 Router] Configuring a Home Route and Fallback Route - Learn An Essential Routing Concept
In this tutorial we are going to learn how to configure the Angular 2 router to cover some commonly ...
- [Angular 2] Angular 2 Smart Components vs Presentation Components
Both Smart Components and Presentation Components receive data from Services in entirely different w ...
- 源码级分析Android系统启动流程
首先看一下Android系统的体系结构,相信大家都不陌生 1.首先Bootloader引导程序启动完Linux内核后,会加载各种驱动和数据结构,当有了驱动以后,开始启动Android系统,同时会加载用 ...
- JavaEE系列之(三)JDBC操作MySQL数据库
一.JDBC简介 JDBC(Java Data Base Connectivity)java数据库连接 SUN公司为了简化.统一对数据库的操作,定义了一套Java操作数据库 ...
- js中获取函数的参数
刘海波 2015/2/11 9:11:43 tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) {return addrow.arguments[pars ...
- 图解java8 stream 的几个转换方法
图片摘自:http://ifeve.com/stream/ 1.distinct 对于stream中包含的元素进行去重复操作(去重复依赖元素的equals方法) 2.filter 对于stream中包 ...