--使用程序块
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
declare @s varchar(8000)
set @s=lower(@@version)
select @s
/*
microsoft sql server 2005 - 9.00.4035.00 (intel x86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 microsoft corporation
enterprise edition on windows nt 5.2 (build 3790: 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 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
(1 個資料列受到影響)
*/
----使用函数
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
if object_id('F_split')is not null drop function dbo.F_split
go
create function F_split(@s nvarchar(1000))
returns nvarchar(1000)
as
begin
declare @str nvarchar(1000),@split nvarchar(100)
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(32),@s),'')
end
return @str
end
go
declare @s varchar(1000)
set @s=lower(@@version)
select dbo.F_split(@s)
/*
Microsoft Sql Server 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
*/
--3借住系統表,或臨時表
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
declare @str varchar(1000)
select @str=char(32)+lower(@@version)
select @str=replace(@str,char(32)+char(number),char(32)+char(number))
from master..spt_values
where type='p' and number between 65 and 90
select stuff(@str,1,1,'')
/*
Microsoft Sql Server 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
(1 個資料列受到影響)
*/
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
declare @s varchar(8000)
set @s=lower(@@version)
select @s
/*
microsoft sql server 2005 - 9.00.4035.00 (intel x86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 microsoft corporation
enterprise edition on windows nt 5.2 (build 3790: 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 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
(1 個資料列受到影響)
*/
----使用函数
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
if object_id('F_split')is not null drop function dbo.F_split
go
create function F_split(@s nvarchar(1000))
returns nvarchar(1000)
as
begin
declare @str nvarchar(1000),@split nvarchar(100)
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(32),@s),'')
end
return @str
end
go
declare @s varchar(1000)
set @s=lower(@@version)
select dbo.F_split(@s)
/*
Microsoft Sql Server 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
*/
--3借住系統表,或臨時表
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 13:40:59
declare @str varchar(1000)
select @str=char(32)+lower(@@version)
select @str=replace(@str,char(32)+char(number),char(32)+char(number))
from master..spt_values
where type='p' and number between 65 and 90
select stuff(@str,1,1,'')
/*
Microsoft Sql Server 2005 - 9.00.4035.00 (intel X86)
nov 24 2008 13:01:59
copyright (c) 1988-2005 Microsoft Corporation
enterprise Edition On Windows Nt 5.2 (build 3790: Service Pack 2)
(1 個資料列受到影響)
*/
标签:
MSSQL,大写字母
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“MSSQL 首字母替换成大写字母”评论...
更新动态
2024年12月27日
2024年12月27日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]