Unix Technical Forum

Need help with collations

This is a discussion on Need help with collations within the SQL Server forums, part of the Microsoft SQL Server category; --> I want to create a database where the table names / column names / SP names are NOTcase sensitive ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:25 PM
Steve Thorpe
 
Posts: n/a
Default Need help with collations

I want to create a database where the table names / column names / SP names
are NOTcase sensitive but where the data in the tables is, so that I can
build a unique index where 'test' and TEST' is accepted as different.

I have tried Installing SQL with a Collation designator with the Case
Sensitive option checked
- this caused all sp names / column names / table names to be case
sensitive - not what I want.

I have also tried installing SQL and selecting a SQL Collation and picking
an option from the drop down list. - again this cause everything to be case
sensitive - not desired

Do I have to install SQL with a non case sensitive collation, then set each
column in the table to be case sensitive? What if any are the problems I am
likely to come across?

Thanks

Steve



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:26 PM
John Bell
 
Posts: n/a
Default Re: Need help with collations

Hi

>
> Do I have to install SQL with a non case sensitive collation, then set

each
> column in the table to be case sensitive? What if any are the problems I

am
> likely to come across?
>


AFAIK this is your only "safe" option. As I am an adocate of using a source
code control system to maintain database object, I would have scripted all
the tables anyhow, and therefore changing colation is a function of the
editor. If you are consistent in changing the colation then I don't envisage
any problems apart from possible data migration problems if they are not
compatible (but I suspect they will be!).You will also have to make sure
that set collations in temporary tables see "Mixed Collation Environments"
in books online.

An alternative would be to force the collation when doing your querysee the
examples for "Collation Precedence" in Books online.

John


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 05:26 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Need help with collations

Steve Thorpe (stephenthorpe@nospam.hotmail.com) writes:
> I want to create a database where the table names / column names / SP
> names are NOTcase sensitive but where the data in the tables is, so that
> I can build a unique index where 'test' and TEST' is accepted as
> different.
>...
> Do I have to install SQL with a non case sensitive collation, then set
> each column in the table to be case sensitive? What if any are the
> problems I am likely to come across?


The best strategy may be to let the server collation be case sensitive,
but create the database with a case-insensitive collation and then declare
each column to be case-insensitive. Then you don't have to bother about
columns in temp tables and table variables, as they will use the system
collation. However names of temp tables will be case-sensitive.

By setting the collation of the database to be case-insensitive,
procedure names, variable names, table names etc are case insensitive.

Note however that variables takes their collation from the database
collation, so if @a = 'TEST' and @b = 'test', @a is equal to @b.

Personally, I'm a strong advocate of that development should always take
place in a case-sensitve environment. If you develop case-insensitive,
and you product is to deployed in a shop where case-sensitivity is the
law, you may get tons of problems.

A collorary of this, is that since it may be a nuisance to remember
whether you called a table OrderDetails or Orderdetails, I stick to
lowercase for all names.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com