--使用程序块 -->Title:生成?y??? -->Author:wufeng -->Date :-- :: declare @s varchar() set @s=lower(@@version) select @s /* microsoft sql server - 9... (intel x) nov :: copyright (c) - microsoft corporation enterprise edition on windows nt 5.2 (build : service pack 2) (1 ???料列受到影?) */ declare @i int,@j int select @i=1,@j=len(@j) while charindex(' ',' '+@s,@i)>0 begin set @I=charindex(' ',' '+@s,@i)+1 if @i>@j continue set @s=stuff(@s,@i-1,1,upper(substring(@s,@i-1,1))) end select @s /* Microsoft Sql Server - 9... (intel X) nov :: copyright (c) - Microsoft Corporation enterprise Edition On Windows Nt 5.2 (build : Service Pack 2) (1 ???料列受到影?) */ ----使用函数 -->Title:生成?y??? -->Author:wufeng -->Date :-- :: if object_id('F_split')is not null drop function dbo.F_split go create function F_split(@s nvarchar()) returns nvarchar() as begin declare @str nvarchar(),@split nvarchar() select @s=@s+' ',@str='' while charindex(' ',@s)>0 begin set @split=left(@s,charindex(' ',@s)) set @str=@str+upper(left(@split,1))+right(@split,len(@split)) set @s=stuff(@s,1,charindex(char(),@s),'') end return @str end go declare @s varchar() set @s=lower(@@version) select dbo.F_split(@s) /* Microsoft Sql Server - 9... (intel X) nov :: copyright (c) - Microsoft Corporation enterprise Edition On Windows Nt 5.2 (build : Service Pack 2) */ --3借住系?表,或??r表 -->Title:生成?y??? -->Author:wufeng -->Date :-- :: declare @str varchar() select @str=char()+lower(@@version) select @str=replace(@str,char()+char(number),char()+char(number)) from master..spt_values where type='p' and number between and select stuff(@str,1,1,'') /* Microsoft Sql Server - 9... (intel X) nov :: copyright (c) - Microsoft Corporation enterprise Edition On Windows Nt 5.2 (build : Service Pack 2) (1 ???料列受到影?) */
推荐整理分享MSSQL 首字母替换成大写字母(sql字段转首字母大写),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:sql字段转首字母大写,sql中文首字母排序,sql中文首字母排序,mysql替换第一个字符,sql中文首字母排序,sql字段转首字母大写,sql替换第二位字符,sql怎么替换字符串中的字母,内容如对您有帮助,希望把文章链接给更多的朋友!
MSSQL 提取汉字实现语句 --Title:生成?y???--Author:wufeng--Date:--::ifobject_id('dbo.get_china_str')isnotnulldropfunctiondbo.get_china_strgocreatefunctiondbo.get_china_str(@strnvarchar())returnsnvarchar
sqlserver 字符串分拆 语句 --Title:生成?y???--Author:wufeng--Date:--::ifobject_id('f_split')isnotnulldropfunctionf_splitgocreatefunctionf_split(@svarchar(),--待分拆的字符串@splitvarchar()--数
实现按关健字模糊查询,并按匹配度排序的SQL语句 IFOBJECT_ID('TB')ISNOTNULLDROPTABLETBGOCREATETABLEtb(IDINTIDENTITY(1,1),VALUENVARCHAR())INSERTtbSELECTN'中国'UNIONALLSELECTN'中国人'UNIONALLSELECTN'中国人民'UNIONALLSELECTN'日本'UNIONALL