0

What purpose would the following function be used for in SQL when specifying fields for a left outer join;

y.[ACCOUNT_ID] COLLATE Modern_Spanish_CI_AS= z.[ACCOUNT_ID] COLLATE Modern_Spanish_CI_AS
devio
  • 36,858
  • 7
  • 80
  • 143
Kate English
  • 55
  • 1
  • 6
  • What kind of "function" are you talking about? Can you share more details, like the system you are using and a valid SQL query? – Nico Haase Apr 08 '20 at 16:33
  • . . . `collate` is not a function. It is kind of rules that gives direction to database engine how to compare and sort the character data. – Yogesh Sharma Apr 08 '20 at 16:35

1 Answers1

0

A collation defines the way strings are sorted and compared.

COLLATE Modern_Spanish_CI_AS refers to the Modern Spanish collation, case-insensitive, accent-sensitiv, i.e. case is ignored, but accents are not ignored.

I don't know your data, but having an accent-sensitive Account_ID sounds "interesting" ;)

On the other hand, if the two Account_ID columns are defined with different collations, or the statement refers to temp tables, enforcing a common collation is reasonable, or even necessary, if the database-level or column-level collation deviates from the server-level collation.

devio
  • 36,858
  • 7
  • 80
  • 143