In the SQLServer2000, according to the BYTE calculation string length

xiaoxiao2021-03-06  42

Execute the following script directly Copy can be described in Create Function GetTelength (@a varchar (2000)) Returns INTAS / * Function Description: Get the byte length of the function mix row string. Parameters: @A Chinese English digital mixed string Returns: length in bytes of the parameter: Wang Haibo 2004-10-14 * / Begin Declare @i int, @ len int Set @ i = 1 Set @ len = 0 While @i <= len (@a) Begin IF Ascii (substring ( @ a, @ i, 1))> 128 --- Judging whether it is an ASCII character, if not plus 2, then add 1 set @ le @ @ LEN 1 set @ i = @ i 1 end return @LENEND

转载请注明原文地址:https://www.9cbs.com/read-55344.html

New Post(0)