matmat
matmat

Reputation: 85

Intersystems Caché SQL. Different behaviour trailing withespaces vs leading withespaces

Given:

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

Answers (1)

joebeeson
joebeeson

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

Related Questions