The = operator is T-SQL not so much "equal" as it is "the same word / phrase, according to the sorting of the context of the expression", and LEN - "the number of characters in the word / phrase." No sorting treats trailing spaces as part of the preceding word / phrase (although they treat leading spaces as part of the line that they precede).
If you need to distinguish 'this' from "this", you should not use the "same words or phrase" operator, because 'this' and "this" are the same word.
Contributing to the work = means that the string equality operator must depend on the contents of its arguments and the context of the expression matching, but it should not depend on the types of arguments if they are both types of strings.
The concept of a natural language "is one and the same word", as a rule, is not precise enough to be captured by a mathematical operator of type =, and there is no concept of a string type in a natural language. Context (i.e., Matching) matters (and exists in natural language) and is part of the story, and additional properties (some of which seem bizarre) are part of the definition of = to make it clearly defined in the unnatural world of data.
In a type question, you do not want the words to change when they are stored in different string types. For example, the types VARCHAR (10), CHAR (10), and CHAR (3) may contain representations of the words "cat" and? = 'cat' should allow us to decide whether the word โcatโ has meaning for any of these types (with questions of accent and accent determined by matching).
Reply to JohnFx comment:
See Using char and varchar data in online documentation. Quote from this page, my hit:
Each char and varchar value has a sort. Notation attributes, such as bit patterns, used to represent each character, comparison rules , and case sensitivity or accent.
I agree that this might be easier to find, but it is documented.
It is also worth noting that the semantics of SQL, where = is related to real data, and the comparison context (unlike something about bits stored on the computer) has been part of SQL for a long time. The premise of RDBMS and SQL is an accurate representation of real data, so collaboration has been supported many years before such ideas (such as CultureInfo) entered the realm of algol-like languages. Making these languages โโ(at least until recently) was a solution to development problems, not business data management. (Recently, the use of similar languages โโin non-technical applications, such as search, has been raiding, but Java, C #, etc. are still struggling with their non-commercial roots.)
In my opinion, itโs unfair to criticize SQL for being different from โmost programming languages.โ SQL was designed to support a business data modeling framework that is very different from development, so the language is different (and better for its purpose).
Hell, when SQL was first, some languages โโdid not have an inline string type. And in some languages, the equals operator between lines does not compare characteristic data at all, but compares links! It would not surprise me if, after a decade or two, the idea that == depends on culture becomes the norm.