Several methods of case sensitive in SQL Server

xiaoxiao2021-03-06  51

Today, I met this question, asked my friends, gave the following solutions, I posted everyone to see: The first: (蟀) Alter Table TBALTER Column Colname NVARCHAR (100) Collate Chinese_PRC_CI_AS - Do not distinguish case ALTER TABLE tb ALTER COLUMN colname nvarchar (100) COLLATE Chinese_PRC_CS_AS - case-sensitive database alter database COLLATE Chinese_PRC_CS_AS second: (tree) - create the following user-defined function (UDF) cREATE fUNCTION StrComp (@ Str1 VARCHAR ( 50), @ str2 varchar (50)) - ALTER FUNCTION STRComp (@ str1 varchar (50), @ str2 varchar (50)) Returns IntegerasBegin Declare @i integer --Declare @ str1 varchar (50) - Declare @ str2 VARCHAR (50) DECLARE @Y INT --SET @ str1 = 'a' --set @ Str2 = 'a' set @ i = 0 --Select ASCII (Substring (@ STR1, @ i 1, 1)) SET @ y = 1 declare @ilen int set @ilen = LEN (Ltrim (r s (@ str1))))

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

New Post(0)