SQL汉字转换拼音
/*
根据汉字获取全拼
1.生成所有读音临时表
2.根据Chinese_PRC_CS_AS_KS_WS 排序获取读音
*/
Create function ChineseSpell(@str varchar(100))
returns varchar(8000)
as
begin
declare @re varchar(8000)
--生成临时表
declare @t table(chr nchar(1) collate Chinese_PRC_CS_AS_KS_WS,py nvarchar(20))
insert into @t select'吖','a'
insert into @t select'厑','aes'
insert into @t select'哎','ai'
insert into @t select'安','an'
insert into @t select'肮','ang'
insert into @t select'凹','ao'
insert into @t select'八','ba'
insert into @t select'挀','bai'
insert into @t select'兡','baike'
insert into @t select'瓸','baiwa'
insert into @t select'扳','ban'
insert into @t select'邦','bang'
insert into @t select'勹','bao'
insert into @t select'萡','be'
insert into @t select'陂','bei'
insert into @t select'奔','ben'
insert into @t select'伻','beng'
insert into @t select'皀','bi'
insert into @t select'边','bian'
insert into @t select'辪','uu'
insert into @t select'灬','biao'
insert into @t select'憋','bie'
insert into @t select'汃','bin'
insert into @t select'冫','bing'
insert into @t select'癶','bo'
insert into @t select'峬','bu'
insert into @t select'嚓','ca'
insert into @t select'偲','cai'
insert into @t select'乲','cal'
insert into @t select'参','can'
insert into @t select'仓','cang'
insert into @t select'撡','cao'
insert into @t select'冊','ce'
insert into @t select'膥','cen'
insert into @t select'噌','ceng'
insert into @t select'硛','ceok'
insert into @t select'岾','ceom'
insert into @t select'猠','ceon'
insert into @t select'乽','ceor'
insert into @t select'叉','cha'
insert into @t select'犲','chai'
insert into @t select'辿','chan'
insert into @t select'伥','chang'
insert into @t select'抄','chao'
insert into @t select'车','che'
insert into @t select'抻','chen'
相关文档:
create function decodehundred(@hundredstring varchar(300) )
returns varchar(1000)
as
begin
declare @tmp varchar(1000),@decodehundred varchar(1000)
set @decodehundred = ''
declare @strno1 varchar(1000)
select @strno1 = 'One Two ......
如果在数据库(sql)中将保存日期的字段的数据类型设置为varchar,而你又需要对这个日期和另外一个日期进行比较,那么该怎么办呢?
1. 第一种方法很容易想到,就是纯粹地利用字符串来比较大小,比如有一个字段为adddate,其数据类型为varchar,要比较这个日期是不是大于某个日期,比如"2006-12-23",那么可以直接写:
where ......
--查询父单位的函数
CREATE Function GetParentUnit(@UnitId bigint, @Level int)
Returns @Parents Table([UnitId] int ,[UnitName] nvarchar(64),[ParentUnitId] int)
As
Begin
If @Level < 1 ......
模仿参考:动易无限分类
优点:算得上是真正的无限分类,不过ParentPath是有局限性,ClassID是标识列自动增一.
缺点:新增过程中ParentID不存在还没有完善,会插入NULL数据.后面三个存储过程还在测试。
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'Is ......
身份证验证算法(SQL版)
/**//*
验证身份证算法
By:刘志伟
2008-1-29与天津
*/
CREATE FUNCTION [fn_ValidateIDC]
(
@idc varchar(18)
)RETURNS BIT
AS
BEGIN
IF LEN(@idc)<>15 AND LEN(@idc)<>18--身份证号只有15或18位
RETURN(0)
IF LEN(@idc)=15 --如果是15位身份证 则只验证日期和是否 ......