SQL Full-width half-width conversion-(excerpt)

Source: Internet
Author: User

/****** SQL Convert full-width/half-width functions start ******/create function Convertwordangle (@str NVARCHAR (4000),--the string to be converted @flag bit--conversion flag, 0 converted to half angle, 1 Convert to perfect corner) RETURNS nvarchar (4000)     as BEGIN DECLARE @pat nvarchar (8), @step int,@i int, @spc int     IF @flag =0         SELECT @ Pat=n '%[! -~]% ', @step =-65248, @str =replace (@str, n ", n")     ELSE         SELECT @pat =n '%[!-~]% ', @step =65248, @str =replace (@str , n ", n")         SET @i=patindex (@pat COLLATE Latin1_General_BIN, @str) while         @i> 0         SELECT @str =replace (@str, SUBSTRING (@str, @i,1),             NCHAR (UNICODE (SUBSTRING (@str, @i,1)) [email protected]),            @i=patindex (@pat COLLATE Latin1_General_BIN, @str)             RETURN (@str) End/****** SQL Convert full-width/half-width function ends ******/--Call Example: Update news set title=dbo. Convertwordangle (title,0);

  

SQL Full-width half-width conversion-(excerpt)

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.