This is my scenario.
SQL Server 2014 Standard edition, I have a database with a collation SQL_Latin1_General_CP437_BIN2
which is case sensitive.
I want to perform a LIKE
query which should return the output irrespective of case sensitive.
Ex: if i execute a Like
query to fetch the records with userName 'John' it should also return rows irrespective of case sensitive 'JOHN', 'John', 'john','joHN'.
I tried using Lcase
, Ucase
, but I am getting the error
Msg 195, Level 15, State 10, Line 4
'LCASE' is not a recognized built-in function name.
This is my sample query
SELECT TOP 300 *
FROM
(SELECT
userNo, userName, Place, Birthdate
FROM usertable
WHERE personid = 2
AND (Name LIKE LCASE('%john%'))
UNION
SELECT
userNo, userName, Place, Birthdate,
FROM usertable2
WHERE personid = 2
AND (Name LIKE LCASE( '%john%') OR Place LIKE LCASE('%NY%')) ) a
ORDER BY
userNo
Guys help me out with your valuable suggestions , I am bit confused of using collation based DB.