Re: New bie to SQL, confused about SQL collation
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Fri, 6 Nov 2009 23:35:20 +0000 (UTC)
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
.
- References:
- New bie to SQL, confused about SQL collation
- From: Althaf
- New bie to SQL, confused about SQL collation
- Prev by Date: Re: EXEC'ing on SQL Server 2008 from 2000
- Next by Date: Re: Running Profiler via a SQL script.
- Previous by thread: Re: New bie to SQL, confused about SQL collation
- Next by thread: Time-Series "Interpolation" Strategies
- Index(es):
Relevant Pages
|