Home  >  Article  >  Backend Development  >  Stored procedure to obtain Pinyin prefix_PHP tutorial

Stored procedure to obtain Pinyin prefix_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:00:41716browse

-- =============================================
-- Create scalar function (NWGetPYFirst)
-- =============================================
IF EXISTS (SELECT *
FROM sysobjects
WHERE name = N'NWGetPYFirst')
DROP FUNCTION NWGetPYFirst
GO
CREATE FUNCTION NWGetPYFirst
(@str varchar(500) = '')
RETURNS varchar(500)
AS
BEGIN
Declare @strlen int,
@return varchar(500),
@ii int,
@c char(1),
@chn nchar(1)
--//初始化变量
Declare @pytable table(
chn char(2) COLLATE Chinese_PRC_CS_AS NOT NULL,
py char(1) COLLATE Chinese_PRC_CS_AS NULL,
PRIMARY KEY (chn)
)
insert into @pytable values('吖', 'A')
insert into @pytable values('八', 'B')
insert into @pytable values('嚓', 'C')
insert into @pytable values('

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631228.htmlTechArticle-- ============================================= -- Create scalar function (NWGetPYFirst) -- ============================================= IF EXISTS (SELECT * FROM sysobjects WHERE...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn