博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sql 查询包含字符的数量统计
阅读量:6692 次
发布时间:2019-06-25

本文共 1608 字,大约阅读时间需要 5 分钟。

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 @testdeclare @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 @test1select * from (values(1,2),(3,4)) mapping(t,v)

 

转载于:https://www.cnblogs.com/Hackerman/p/6013007.html

你可能感兴趣的文章
Microsoft .Net Remoting系列专题之三:Remoting事件处理全接触
查看>>
JavaScript常用标签和方法总结
查看>>
GO语言的进阶之路-网络编程之socket
查看>>
作业—四则运算题目生成器
查看>>
第十四周翻译-《Pro SQL Server Internals, 2nd edition》
查看>>
jdbcUrl is required with driverClassName spring boot 2.0版本
查看>>
C# 关于JArray和JObject封装JSON对象
查看>>
【Visual C++】游戏开发笔记之十 基础动画显示(三) 透明动画的实现
查看>>
今目标反思
查看>>
SQL Server 备份的 8 种方法。
查看>>
SQL Server 从数据库快照还原数据库
查看>>
$(document).keydown
查看>>
对Java、C#转学swift的提醒:学习swift首先要突破心理障碍。
查看>>
面向对象 2017-4-15
查看>>
java项目导出war包
查看>>
算法第三章实践报告
查看>>
linux应用之Mongodb的安装及配置(centos)
查看>>
Python 面向对象 --- eval 函数
查看>>
PHP的错误和异常处理
查看>>
z-index兼容问题:关于ie6/7下的z-index
查看>>