新增文章
文章标题
分类
C#
云星空
K3 BOS
K3 功能
用友
Oracle
python
SQL
MySql
PHP
HTML
script
windows
Access
影视后期
财务
服务
生活
内容
------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --【函数】 删除 if exists ( select * from sys.objects where object_id = object_id(N'dbo.a_CnTxt') and type in (N'FN', N'if', N'TF', N'FS', N'FT') ) drop function dbo.a_CnTxt go ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --【函数】 dbo.a_CnTxt( 'xxx' ) 提取中文 create function dbo.a_CnTxt ( @Txt varchar(max) ) returns varchar(max) as begin --------------------------------------------------------------------------------------------------------------------------------------------- declare @Word nchar(1) ,@Cn varchar(max) set @Cn = '' while len(@Txt) > 0 begin set @Word = LEFT( @Txt ,1 ) if ( UNICODE( @Word ) BETWEEN 11904 and 12245 ) OR ( UNICODE( @Word ) BETWEEN 13312 and 40938 ) OR ( UNICODE( @Word ) BETWEEN 59413 and 59492 ) OR ( UNICODE( @Word ) BETWEEN 57424 and 57838 ) OR ( UNICODE( @Word ) BETWEEN 63744 and 64046 ) OR ( UNICODE( @Word ) BETWEEN 64047 and 64109 ) begin set @Cn = @Cn + @Word end set @Txt = RIGHT( @Txt ,len(@Txt)-1 ) end --------------------------------------------------------------------------------------------------------------------------------------------- return @Cn end /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ select dbo.a_CnTxt( '金额B(+本23位.币-3,)$as2#0.6BCD' ) -- 提取中文:金额本位币 ------------------------------------------------------------------------------------------------------------------ -- 查看 UNICODE 对应的文字 declare @Int int set @Int = 1 declare @Int2 int set @Int2 = @Int + 5000 while @Int < @Int2 begin PRINT convert( varchar(100),@Int ) + char(9) + isnull( nchar(@Int),'') set @Int += 1 end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */ go
返回
保存