Technical Article

Campare Case Insensitive  CampareCaseInsensitive

,

Case Insensitive Camparison remains a problem for most developers since SQL Server not supports any built in function for these purpose here is one wich compares varchar strings and returns 1 is mathes and 0 other wise

select dbo.CampareCaseInsensitive('A','a')

create function CampareCaseInsensitive 
(
@str1 varchar(100),
@str2 varchar(100)
)
returns integer
as
begin

declare @retVal integer
set @retVal=0

if cast(@str1 as varbinary(100))=cast(@str2 as varbinary(100) )
set @retVal=1

return @retVal

end

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating