-- ============================================= -- 功能:汉字转换成拼音首字母 首字母查 -- ============================================= )='') ) as begin --定义变量 ), @ii int ),) --设置初始值 --开始循环取出没个字符 while @ii<@strlen begin ,,) if @chn>'z' ,@c = case chn when @chn then
SQL教程地址:http://www.w3school.com.cn/sql/index.asp TOP 子句 TOP 子句用于规定要返回的记录的数目. 对于拥有数千条记录的大型表来说,TOP 子句是非常有用的. 注释:并非所有的数据库系统都支持 TOP 子句. SQL Server 的语法: SELECT TOP number|percent column_name(s) FROM table_name MySQL 和 Oracle 中的 SQL SELECT TOP 是等价的 MySQL 语
目前工作中遇到一个情况,需要将SQL Server中的一个字段提取拼音的首字母,字段由汉字.英文.数字以及“-”构成,百度了一堆,找到如下方法,记录一下,以备后用! 首先建立一个函数 --生成拼音首码 )) ) --WITH ENCRYPTION as begin declare @intLen int ) ) set @intLen = len(@str) set @strRet = '' begin set @temp = '' select @temp = case ) >= '帀' th
if exists (select * from sysobjects where id = object_id(N'[fn_ChineseToSpell]') and xtype in (N'FN', N'IF', N'TF')) www.2cto.com drop function [fn_ChineseToSpell]GO/*创建取拼音首字母函数*/ create function [dbo].[fn_ChineseToSpell](@strChinese varchar(500)='')
---查看所有存储过程或视图的位置 select a.name,a.[type],b.[definition] from sys.all_objects a,sys.sql_modules b where a.is_ms_shipped=0 and a.object_id = b.object_id and a.[type] in ('P','V','AF') order by a.[name] ASC GO --1.查看所有存储过程与函数 exec sp_stored_procedures -
ql获取汉字的拼音首字母 if exists (select * from sysobjects where id = object_id(N'[fn_ChineseToSpell]') and xtype in (N'FN', N'IF', N'TF')) www.2cto.com drop function [fn_ChineseToSpell] GO /*创建取拼音首字母函数*/ create function [dbo].[fn_ChineseToSpell](@
在sql中怎么查看一个字符的ascii编码或Unicode编码: SELECT ASCII('a') AS [AsciiNum]--字符获取ASCII码 SELECT UNICODE(N'a') AS [UnicodeNum]--字符获取UNICODE编码 ) AS [返回类型为CHAR(1)]--ASCII码转字符类型CHAR(1) ) AS [返回类型为NVARCHAR(1)]--ASCII码转字符类型NVARCHAR(1) 结果如下: 还有一点,Unicode编码只编码第一个 ) ) ')