By using the flexible use of the CHARINDEX, PATINDEX, and wildcard functions, we can determine that the method containing the sub-string in the string does not have source code and Demonstration: Source Code 1. query whether the string contains non-numeric characters SELECTPATINDEX (% [^ 0-9] %, 1235X461) SELECTPATINDEX (% [^ 0-9] %, 12350461) 2. query whether a package is included in a string
By using the flexible use of the CHARINDEX, PATINDEX, and wildcard functions, we can determine that the method containing the sub-string in the string does not have source code and Demonstration: Source Code 1. whether the query string contains the non-numeric character select patindex ('% [^ 0-9] %', '1235x461 ') select patindex (' % [^ 0-9] % ', '123') 2. query whether a package is included in a string
Using the flexible use of the CHARINDEX, PATINDEX, and wildcard functions, we can determine the method for containing a substring in a string. <无>
Source code and demo:Source code
1. whether the query string contains the non-numeric character select patindex ('% [^ 0-9] %', '1235x461 ') select patindex (' % [^ 0-9] % ', '123') 2. query whether the string contains the numeric character select patindex ('% [0-9] %', 'suyllgoo') select patindex ('% [0-9] % ', 'suyllpolico') 3. the FUNCTION determines that the string only contains the number create function [dbo]. fn_IsNumeric (@ pString VARCHAR (8000) RETURNS bitWITH ENCRYPTIONASBEGINDECLARE @ vJudge intSET @ vJudge = 0 SELECT @ vJudge = casewhen patindex ('% [0-9] % ', LOWER (@ pString)> 0 THEN 0 when patindex ('% [0-9] %', LOWER (@ pString )) = 0 THEN 1 ENDRETURN @ vJudgeEND4. the FUNCTION determines that the string only contains letters (case-insensitive) create function [dbo]. fn_IsAlpha (@ pString VARCHAR (8000) RETURNS bitWITH ENCRYPTIONASBEGINDECLARE @ vJudge intSET @ vJudge = 0 SELECT @ vJudge = casewhen patindex ('% [a-z] % ', LOWER (@ pString)> 0 THEN 0 when patindex ('% [a-z] %', LOWER (@ pString) = 0 THEN 1 ENDRETURN @ vJudgeEND