MSSQL converts the first letter to the implementation statement of the upper limit. For more information, see.
MSSQL converts the first letter to the implementation statement of the upper limit. For more information, see.
-- Use the program block
--> Title: generate a sequence number.
--> Author: wufeng4552
--> Date: 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)
(A data column is affected)
*/
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)
(A data column is affected)
*/
---- Use functions
--> Title: generate a sequence number.
--> Author: wufeng4552
--> Date: 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 borrow the system table or the hour table
--> Title: generate a sequence number.
--> Author: wufeng4552
--> Date: 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)
(A data column is affected)
*/