sqlserver区分大小写
CREATE FUNCTION StrComp(@Str1 VARCHAR(50),@Str2 VARCHAR(50)) RETURNS INTEGER AS BEGIN DECLARE @i INTEGER DECLARE @y INT SET @i=0 SET @y=1 DECLARE @iLen INT SET @iLen = LEN(LTRIM(RTRIM(@Str1))) IF LEN(LTRIM(RTRIM(@Str1))) < LEN(LTRIM(RTRIM(@Str2))) SET @iLen = LEN(LTRIM(RTRIM(@Str2))) WHILE (@i < @iLen) BEGIN IF (ASCII(SUBSTRING(@Str1,@i+1,1))=ASCII(SUBSTRING(@Str2,@i+1,1))) SET @i = @i +1 ELSE BEGIN SET @y=0 BREAK END END RETURN @y END dbo.StrComp(Field1,'aAbB')=1