The MSSQL initials are replaced with uppercase letters _MSSQL

Source: Internet
Author: User
Tags microsoft sql server microsoft sql server 2005 mssql pack
--Using a program block

-->title: Generating test data
-->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 data columns are impacted)
*/
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 data columns are impacted)
*/

----using functions

-->title: Generating test data
-->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), @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 the system table, or the time table

-->title: Generating test data
-->author:wufeng4552
-->date:2009-09-21 13:40:59
DECLARE @str varchar (1000)
Select @str =char +lower (@ @version)
Select @str =replace (@str, char () +char (number), char (a) +char (number))
From Master.. Spt_values
Where type= ' P ' and number between 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 data columns are impacted)

*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.