Reputation: 85
Given:
The contents of the table are:
ID || Description
1 || "String1"
2 || "String2"
3 || "String3"
If I execute the following SQL query:
"SELECT ID FROM tA WHERE Description = 'String2'" it returns 2 (as expected)
But:
If I execute the following SQL query:
"SELECT ID FROM tA WHERE Description = 'String2 '" (trailing withespaces) it also returns 2! (as it is an exact comparison, it should return NONE)
If I execute the following SQL query:
"SELECT ID FROM tA WHERE Description = ' String2'" (leading withespaces) it returns NONE (as expected)
Do you know what is the reason of this difference in behaviour?
Thanks in advance.
Upvotes: 1
Views: 139
Reputation: 4366
You need to use "%EXACT" around your column name. This should return no records: "SELECT ID FROM tA WHERE %EXACT(Description) = 'String2 '"
Upvotes: 1