Re: SQL7: case sensitivity

From: Steve Kass (skass_at_drew.edu)
Date: 04/19/04


Date: Mon, 19 Apr 2004 01:30:46 -0400

Jochen,

  While upper and lower case characters are stored differently in SQL
Server tables, and their binary representations can be distinguished.
But distinguished doesn't mean distinct from the point of view of a
UNIQUE constraint. It is the database collation that determines whether
x = y evaluates to true or to false for two strings x and y, and the
comparison x = y is what's used to determine if non-null strings are to
be considered as distinct or not. If a case-insensitive collation is in
place (this is the default instance collation, which extends to
databases for which no collation was specified upon creation), then x =
y evaluates to true if x and y differ only in case, and you will see a
violation of the unique constraint if you try to put such values in a
unique-indexed column.

  I believe that in SQL Server 7 you can specify the collation on a
per-database level, so you may wish to store this data in a database
with a case-sensitive collation.

  However, I don't know what rules Unix uses to determine if two strings
are identical or not. If Unix makes a binary comparison of the strings,
you could consider storing the filenames in a varbinary(...) column
instead of varchar(...).

Steve Kass
Drew University

Jochen Daum wrote:

>Hi,
>
>I have a table, which is supposed to store filenames stored on a Unix
>filesystem. I seem to be having problems with case sensitivity there:
>
>I can store two files, with the same name and different spellings, eg.
>test1.txt and Test1.txt
>
>But I cannot set a unique index on the columns that stores the
>filename, it reports duplicates for this file.
>
>Can someone point me to options?
>
>Thanks in advance,
>
>Jochen
>
>
>
>



Relevant Pages

  • Re: Urgent help needed. How to search using LIKE if keyword itself is "%"?
    ... > The way strings are compared and sorted is determined by a Collation. ... > at server, database and column level. ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL7: case sensitivity
    ... In SQL Server 7 you specify the collation on the SERVER level (this is ... changed in SQL Server 2000 where you can specify it down to column level). ... which is supposed to store filenames stored on a Unix ...
    (microsoft.public.sqlserver.programming)
  • SQL2000 Collation Problem
    ... Use Unicode, nchar, nvarchar, ntext instead. ... language independant and will store any character you ... >How do I set the collation on SQL2000 so that I can store ...
    (microsoft.public.sqlserver.server)
  • Re: Changing Collations
    ... SQL Server but I need to "map" some of the ... strings to a different collation. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Changing Collations
    ... I need to load some data from VC++ into ... SQL Server but I need to "map" some of the ... strings to a different collation. ...
    (microsoft.public.dotnet.languages.vc)