RE: Collation....
From: Bart Duncan [MSFT] (bartd_at_online.microsoft.com)
Date: 10/13/04
- Next message: Tibor Karaszi: "Re: IN vs EXISTS vs INNER JOIN"
- Previous message: Tibor Karaszi: "Re: user access"
- In reply to: John Smith: "Collation...."
- Next in thread: John Smith: "Re: Collation...."
- Reply: John Smith: "Re: Collation...."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 13 Oct 2004 17:09:23 GMT
ANSI SQL-92 suggests that two strings which differ only in trailing spaces
should be considered equal. In SQL Server, with most collations a simple
'=' operator complies with this. In SQL there are only two exceptions to
this that I know of:
- Use 'LIKE' instead of '='. LIKE considers trailing spaces in the search
criteria (right operand) to be significant. However, trailing blanks in
the column to be searched (left operand) are still ignored. See the
Remarks section of the "LIKE" topic in Books Online for details and some
examples.
- Use a binary collation such as SQL_Latin1_General_BIN. Note, however,
that this will treat all code points as different characters. For example,
'e' will be considered a different string than 'E'.
Bart
------------
Bart Duncan
Microsoft SQL Server Support
Please reply to the newsgroup only - thanks.
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "John Smith" <JSmith_67@hotmail.com>
| Subject: Collation....
| Date: Wed, 13 Oct 2004 09:39:30 -0700
| Lines: 7
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#9iatNUsEHA.3012@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.programming
| NNTP-Posting-Host: 64.173.130.210
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.programming:478182
| X-Tomcat-NG: microsoft.public.sqlserver.programming
|
| I am using SQL Server 2000.
| When I run a query I want to differentiate between the data "E" and "E ".
| How to differentiate the data which has blank space after it and which
does
| not have blank space after it? Thanks for your answers.
| Smith
|
|
|
- Next message: Tibor Karaszi: "Re: IN vs EXISTS vs INNER JOIN"
- Previous message: Tibor Karaszi: "Re: user access"
- In reply to: John Smith: "Collation...."
- Next in thread: John Smith: "Re: Collation...."
- Reply: John Smith: "Re: Collation...."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|