转换拼音简码
2016-05-20 08:48
405 查看
执行:dbo.FB_GetChineseSpell(chzxm)
CREATE FUNCTION [dbo].[FB_GetChineseSpell]
(
@Str varchar(500)=''
)
RETURNS varchar(500)
as
begin
declare @strLen int
declare @index int
declare @VChControl char(2)
DECLARE @VChSpell VARCHAR(30)
declare @return varchar(500)
set @return=''
set @strlen=len(@str)
set @index=1
while @index<=@strlen
begin
select @VChControl=substring(@str,@index,1)
IF @VChControl>'啊' AND @VChControl<'芭'
SELECT @VChSpell='A'
ELSE IF @VChControl>='芭' AND @VChControl<'擦'
SELECT @VChSpell='B'
ELSE IF @VChControl>='擦' AND @VChControl<'搭'
SELECT @VChSpell='C'
ELSE IF @VChControl>='搭' AND @VChControl<'娥'
SELECT @VChSpell='D'
ELSE IF @VChControl>='娥' AND @VChControl<'发'
SELECT @VChSpell='E'
ELSE IF @VChControl>='发' AND @VChControl<='嘎'
SELECT @VChSpell='F'
ELSE IF @VChControl>'嘎' AND @VChControl<'哈'
SELECT @VChSpell='G'
ELSE IF @VChControl>='哈' AND @VChControl<'击'
SELECT @VChSpell='H'
ELSE IF @VChControl>='击' AND @VChControl<'喀'
SELECT @VChSpell='J'
ELSE IF @VChControl>='喀' AND @VChControl<'垃'
SELECT @VChSpell='K'
ELSE IF @VChControl>='垃' AND @VChControl<'妈'
SELECT @VChSpell='L'
ELSE IF @VChControl>='妈' AND @VChControl<'拿'
SELECT @VChSpell='M'
ELSE IF @VChControl>='拿' AND @VChControl<'哦'
SELECT @VChSpell='N'
ELSE IF @VChControl>='哦' AND @VChControl<'啪'
SELECT @VChSpell='O'
ELSE IF @VChControl>='啪' AND @VChControl<'期'
SELECT @VChSpell='P'
ELSE IF @VChControl>='期' AND @VChControl<'然'
SELECT @VChSpell='Q'
ELSE IF @VChControl>='然' AND @VChControl<'撒'
SELECT @VChSpell='R'
ELSE IF @VChControl>='撒' AND @VChControl<'塌'
SELECT @VChSpell='S'
ELSE IF @VChControl>='塌' AND @VChControl<'挖'
SELECT @VChSpell='T'
ELSE IF @VChControl>='挖' AND @VChControl<'昔'
SELECT @VChSpell='W'
ELSE IF @VChControl>='昔' AND @VChControl<'压'
SELECT @VChSpell='X'
ELSE IF @VChControl>='压' AND @VChControl<'匝'
SELECT @VChSpell='Y'
ELSE IF @VChControl>='匝' AND @VChControl<='座'
SELECT @VChSpell='Z'
ELSE
SELECT @VChSpell=@VChControl
SELECT @return=@return + RTRIM(UPPER(@VChSpell))
set @index=@index+1
end
return(@return)
end
CREATE FUNCTION [dbo].[FB_GetChineseSpell]
(
@Str varchar(500)=''
)
RETURNS varchar(500)
as
begin
declare @strLen int
declare @index int
declare @VChControl char(2)
DECLARE @VChSpell VARCHAR(30)
declare @return varchar(500)
set @return=''
set @strlen=len(@str)
set @index=1
while @index<=@strlen
begin
select @VChControl=substring(@str,@index,1)
IF @VChControl>'啊' AND @VChControl<'芭'
SELECT @VChSpell='A'
ELSE IF @VChControl>='芭' AND @VChControl<'擦'
SELECT @VChSpell='B'
ELSE IF @VChControl>='擦' AND @VChControl<'搭'
SELECT @VChSpell='C'
ELSE IF @VChControl>='搭' AND @VChControl<'娥'
SELECT @VChSpell='D'
ELSE IF @VChControl>='娥' AND @VChControl<'发'
SELECT @VChSpell='E'
ELSE IF @VChControl>='发' AND @VChControl<='嘎'
SELECT @VChSpell='F'
ELSE IF @VChControl>'嘎' AND @VChControl<'哈'
SELECT @VChSpell='G'
ELSE IF @VChControl>='哈' AND @VChControl<'击'
SELECT @VChSpell='H'
ELSE IF @VChControl>='击' AND @VChControl<'喀'
SELECT @VChSpell='J'
ELSE IF @VChControl>='喀' AND @VChControl<'垃'
SELECT @VChSpell='K'
ELSE IF @VChControl>='垃' AND @VChControl<'妈'
SELECT @VChSpell='L'
ELSE IF @VChControl>='妈' AND @VChControl<'拿'
SELECT @VChSpell='M'
ELSE IF @VChControl>='拿' AND @VChControl<'哦'
SELECT @VChSpell='N'
ELSE IF @VChControl>='哦' AND @VChControl<'啪'
SELECT @VChSpell='O'
ELSE IF @VChControl>='啪' AND @VChControl<'期'
SELECT @VChSpell='P'
ELSE IF @VChControl>='期' AND @VChControl<'然'
SELECT @VChSpell='Q'
ELSE IF @VChControl>='然' AND @VChControl<'撒'
SELECT @VChSpell='R'
ELSE IF @VChControl>='撒' AND @VChControl<'塌'
SELECT @VChSpell='S'
ELSE IF @VChControl>='塌' AND @VChControl<'挖'
SELECT @VChSpell='T'
ELSE IF @VChControl>='挖' AND @VChControl<'昔'
SELECT @VChSpell='W'
ELSE IF @VChControl>='昔' AND @VChControl<'压'
SELECT @VChSpell='X'
ELSE IF @VChControl>='压' AND @VChControl<'匝'
SELECT @VChSpell='Y'
ELSE IF @VChControl>='匝' AND @VChControl<='座'
SELECT @VChSpell='Z'
ELSE
SELECT @VChSpell=@VChControl
SELECT @return=@return + RTRIM(UPPER(@VChSpell))
set @index=@index+1
end
return(@return)
end
相关文章推荐
- java集合类
- 多表关联的update语句
- 制造“你”的电视 被乐视颠覆的传统彩电业何处去?
- 获取浏览器类型
- 深入理解JS addLoadEvent函数
- 使用U3D 实现 Android Launcher(提供源码)
- 大于23的男生女生都该看.看完你会变一个人
- Android中handler的一点讲解
- SQL 用B表数据更新A表数据
- C# DataGridViewButtonColumn的使用—动态改变按钮的文本
- WPF与WinForm开发有什么区别?
- 推荐10 个短小却超实用的 JavaScript 代码段
- 冒泡排序,选择排序,插入排序
- tomcat缓存问题
- Android 布局
- 消息异常处理
- Ant_的最完整build.xml解释
- $(function(){})和$(document).ready(function(){})
- [转][色彩 A] – 永远不要使用纯黑
- .NET Framework 4和.NET Framework 4 Client Profile的区别与联系