I need to know how to create a query that is case sensitive and can include wildcards. I found this code:
But it doesn't allow wildcards. I modified it to this:
But PatIndex() is case in-sensitive so it only compares the first instance of the (in-sensitive) search term. In other words, if I were searching for 'AAA' it would match 'xxxAAAaaaxxx' but not 'xxxaaaAAAxxx'.
Is there another way? I'm using SQL Server 7.0 and changing the whole server to be Case Sensitive is out of the question. HELP!
Code:
Select * From table Where CAST(@searchTerm AS varbinary(12))=CAST(dbField AS varbinary(12))
But it doesn't allow wildcards. I modified it to this:
Code:
Select * From table Where CAST (@searchTerm AS varbinary(12)) = CAST (SubString(dbField,PatIndex('%'+@searchTerm+'%',dbField),Len(@searchTerm)) AS varbinary(12))
But PatIndex() is case in-sensitive so it only compares the first instance of the (in-sensitive) search term. In other words, if I were searching for 'AAA' it would match 'xxxAAAaaaxxx' but not 'xxxaaaAAAxxx'.
Is there another way? I'm using SQL Server 7.0 and changing the whole server to be Case Sensitive is out of the question. HELP!