Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String comparisons in where clauses
Message
De
08/11/2013 18:08:51
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
String comparisons in where clauses
Versions des environnements
SQL Server:
SQL Server 2008 R2
Application:
Web
Divers
Thread ID:
01587602
Message ID:
01587602
Vues:
37
Did I miss something between 2005 and 2008 R2 regarding comparing string values for where clauses and joins?

I seemed to remember when I was learning TSQL coming from VFP that you had to be careful in you remote views and I was always defensively using LIKE instead of = and throwing % around at the end of strings to compare and RTRIM ing just about any CHAR column

Anyway, as I'm converting a bunch of VFP views to a SQL backend I'm finding even though the SQL tables hardly ever use VARCHAR and the data was converting without trimming I can say

WHERE table.cname = ?vp_name and not worry about spaces etc even if vp_name is 'Joe ' and the cname col is char(5) (these may not be the best examples but I am very surprised it seems to behave more like VFP now than it used to.

Am I remembering a problem that never existed or did something change in TSQL?


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform