Re: New bie to SQL, confused about SQL collation



Althaf (althafexcel@xxxxxxxxx) writes:
QUESTON # 1
----------------------
I'm confused about the SQL collation, what is it actually for?. I
created a new database and later checked my SQL collaction it is set
to SQL_Latin1_General_CP1_CS_AS. The problem what i have now is
accessing the field names / tablename has become case sensitive. No
idea how this happend.

for ex. SELECT CHANNEL_NAME from table1 does not work
select Channel_Name from Table1 works

I'm getting mad about this, why is the field and tablenames have
become case sensitive. how do i make it to normal i mean in case
sensitive.

As Bill said, the database collation affects both data and metadata.

I like to point out that since you intend to use multiple languages and
use Unicode, you should not use an SQL collation, but you should use a
Windows collation. For nvarchar an SQL collation behaves just like a
Windows collation, but for varchar SQL collations have its own specific
rules. This can lead to unexpceted surprises, not the least with
performance.

I'm making a content database for news management. Example, A single
article would have English, Arabic and spanish content. So my table is
as below.

Table # 1

ID Bigint
English_Title Nvarchar
Spanish_Title Nvarchar
Arabic_Title Nvarchar
English_Content Nvarchar
Spanish_Content Nvarchar
Arabic_Content Nvarchar

is it advisable to do so?, i made it as above as i want the data
related to one article (of all languages) to be stored in a single row
of a table. Now what should be the collation for my database in this
case. is collation related to storing of content also.

Bill made a good point that if you store the strings in a table keyed by
ID and language, you have something which is more extensible and easier
to use.

However, if you need to sort and index these values, that approach raiaes
some problems. With separate columns you can set the appropriate collation
for each column, Latin1_General_CS_AS for English, Modern_Spanish_CS_AS for
Spanish and Arabic_CS_AS for Arabic.






--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • Re: Database collation error after moving to a remote sql server
    ... I think I'm going to try plan B: Install a second instance of SQL 2000 onto ... the remote server and set its default collation to the same as my SMS ... database, then move my db to the new instance. ... The char, varchar, text, nchar, nvarchar, or ntext system data types, ...
    (microsoft.public.sms.setup)
  • Re: Case Insensitive lookup in DB
    ... Is your SQL Server installed with a case sensitive collation? ... And while you might be able to reset the collation of a database by using ...
    (microsoft.public.inetserver.asp.general)
  • RE: Install SQL Server 2000 with different COLLATION
    ... When you upgrade an existing SQL 7.0 instance, ... always inherits the 7.0 instance's collation. ... If you want to install SQL ... Microsoft SQL Server Support ...
    (microsoft.public.sqlserver.server)
  • Re: To unicode or not?
    ... Then again, since SQL Server stores Unicode data in the UCS-2 encoding, ... use them with varchar, you simply work with a subset of the characers, ... an SQL collation is just a Windows collation ...
    (comp.databases.ms-sqlserver)
  • RE: New Paper: Microsoft SQL Server Passwords
    ... Unfortunately changing the collation to case sensitive means that all the ... stored procedures and direct sql queries need to be case sensitive as well. ... are checked on non-production database before proceeding. ... > Subject: New Paper: Microsoft SQL Server Passwords ...
    (Bugtraq)