I have the following code in SQL Server 2014 Enterprise:
SELECT c.Id
FROM dbo.Content c
WHERE c.Id = 8753495 AND c.Content LIKE '%Paypal%'
This code is used to know if the content has a match with the word Paypal and is returning 0 results, and for that id, I know it has in the content the word "Paypal" .
I've tried with different words of the content and with some words it's working and with others doesn't.
The database as well as the Content
table both use the SQL_Latin1_General_CP1_CI_AS
collation.
Can anyone help me?
EDIT: The purpose of this query is do something else, not only return the id, but I found the problem on the like operator, so I give you the part that is failing
Also tried with upper/lower but still doesn't work
Here is the creation script.
CREATE TABLE [dbo].[Content](
[Id] [int] NOT NULL,
[Content] [nvarchar](max) NULL,
CONSTRAINT [PK_Content_1] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Thanks for the replies.
EDIT 2: This question isn't answer by the Like operation returns no rows on nvarchar column filter if the column data start with numeric . There was a space at the end of the pattern.
The problem here was a malicious client that put characters that looks similar, this way avoids verifications and could send spam
For example, the Unicode 1056 decimal (420 hexa) is a greek character similar to the Latin P (Ascii 80)
Well, I found the error.
The content was uploaded by a client (a spammer) and when look the ascii of each character, I found out that the client put the content on unicode characters that are similar.
So "Paypal" wasn't "Paypal" like expected, here is the result of the Paypal word with the comparison with expected result:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.