网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > SQL技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
本月文章推荐
.循序渐进讲解数据表的十二个设计.
.SQL Server 2008主要功能在兼容性.
.SQL Server 2000的数据库容量究竟.
.SQL Server 2005数据加密技术应用.
.SQL Server通用分页存储过程:利.
.SQL SERVER应用问题解答13例(三.
.SQL Server 2005 Reporting Serv.
.SQL server如何定时执行一些脚本.
.轻松掌握SQL Server数据同步技术.
.经验总结:SQL Server数据库对上.
.在SQL Server 2000里设置和使用数.
.数据转换冲突及转换过程中大对象.
.在SQL Server 2005数据库中实现自.
.由于NLS参数设置不当导致的性能问.
.sql server 灾难恢复.
.使用程序导出建表语句,及以Inse.
.在SQL Server2005中用语句创建数.
.ASE锁模式:AllPages DataPages .
.Microsoft SQL Server 2005同步复.
.SQL Server中全角和半角字符的比.

Sql server 如何得到汉字的声母

发表日期:2007-3-19


在sql中创建用户自定义拼音函数:
  create function f_GetPy(@Str nvarchar(400))
  returns nvarchar(4000)
  as
  begin
  declare @strlen int,@re nvarchar(4000)
  declare @t table(chr nchar(1) collate Chinese_PRC_CI_AS,letter nchar(1))
  insert @t select '吖','A' union all select '八','B'
  union all select '嚓','C' union all select '咑','D'
  union all select '妸','E' union all select '发','F'
  union all select '旮','G' union all select '铪','H'
  union all select '丌','J' union all select '咔','K'
  union all select '垃','L' union all select '嘸','M'
  union all select '拏','N' union all select '噢','O'
  union all select '妑','P' union all select '七','Q'
  union all select '呥','R' union all select '仨','S'
  union all select '他','T' union all select '屲','W'
  union all select '夕','X' union all select '丫','Y'
  union all select '帀','Z'

  select @strlen=len(@str),@re=''
  while @strlen>0
  begin
  select top 1 @re=letter+@re,@strlen=@strlen-1
  from @t a where chr<=substring(@str,@strlen,1)
  order by chr desc
  if @@rowcount=0
  select @re=substring(@str,@strlen,1)+@re,@strlen=@strlen-1
  end
  return(@re)
  end
  go
  --测试
  select dbo.f_GetPy('东莞市') as 东莞市,dbo.f_GetPy('ab中c国人') as 中国人

  --以后查询的时候,就可以调用上面的函数来实现汉字模糊查询

  select * from 表 where dbo.f_getpy(字段)='zgyh'

上一篇:删除流氓的SQL Server2005 人气:4138
下一篇:sql server中order by部分使用方式 人气:4277
浏览全部Sql server的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐