473,804 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL2005 collation vs Oracle

Hi there,

Is it posible to set the collation of SQL server 2005 like Oracle, which is
that objects names and column names are case-insensitive, but data is
sensitive;e.g:

In Oracle:
--create lower-case table and column name
create table t1(c1 char(10));
--Mike with upper-case J
insert into t1 values('Mike');
--follwoing I'm changing case in the table name, but it works, however
'Mike' has to be with uppewr case M
select * from T1 where c1='Mike'

Above test fails in SQL server. Is there a collation which can make data
'literals' sensitive, but data dictionary or the object names and column
names case insensitive?

TIA,
Nasir

May 11 '06
27 16501
>I think Oracle got it right. It should not matter if you use MYTABLE,
MyTable, or mytable in your SQL statement FROM clause. The database
should recognize the table name. But data should be stored exactly as
entered so that mike, Mike, and MIKE should be different. There are
As for data Oracle has it completely wrong, collation should reflect the
real world if a salesman shouts out AKA do they mean aka, Aka, AKa, AKA or
what???? You should not have to rely on doing this data verification
yourself, adding constraints to check case etc... is just making up for a
poor initial decision to go with case sensitivity.

This is the biggest pain in the arse in the business intelligence and
reporting area.

Case Insensitive is how the real world works and that should be the default
for any database 'period'.

As for Object names it shouldn't matter but case insenitive promotes poor
programming practice.

Consider portability to other products and systems.....

IMHO....

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Mark D Powell" <Ma*********@ed s.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .I think Oracle got it right. It should not matter if you use MYTABLE,
MyTable, or mytable in your SQL statement FROM clause. The database
should recognize the table name. But data should be stored exactly as
entered so that mike, Mike, and MIKE should be different. There are
easy ways to handle forcing the data into a standard storage format via
column level constraints, table triggers, and single row functions like
UPPER, LOWER, and INITCAP. And there are ways to perform case
insensative compares where needed or desired.

Standarding data entry so that you do not end up with what amounts to
duplicates due to variation of entry has been an application issue
since computers were invented. Example: Johnson Inc. vs Johnson
Incorporated. Allowing the CAPLOCK key to add additional variables to
the mix is just asking for data integrity problems. Ever column of
every table in the application should have data entry rules. Then you
do not end up having to know or figure out if you are looking for MIKE,
mike, or Mike.

IMHO -- Mark D Powell --

May 12 '06 #11
Latin1_General_ CS_AS will solve some problems, but not all:

SQL Server:

CREATE TABLE t1(c1 CHAR(10) COLLATE Latin1_General_ CS_AS NOT NULL);
INSERT INTO t1 VALUES('AAA');
INSERT INTO t1 VALUES('A_A');

SELECT * FROM T1 order by c1;

c1
----------
A_A
AAA

(2 row(s) affected)

drop table t1;

The same script in Oracle running on UNIX returns rows in a different
order:

C1
----------
AAA
A_A
2 rows selected

May 12 '06 #12
> As for data Oracle has it completely wrong,

If you do not like the default collation, then change it. Both SQL
Server and Oracle let you change the case sensitivity of its data.
collation should reflect the
real world if a salesman shouts out AKA do they mean aka, Aka, AKa, AKA or
what????
Agreed with your example, but in the real world, case can matter for
some data. Is your name "tony", "Tony", or "ToNy"? It does make a
difference when referring to proper nouns. If it didn't make a
difference, then "e. e. cummings" name would not have garnered so much
attention throughout the years.

Sometimes, case does not matter, sometimes it does.
You should not have to rely on doing this data verification
yourself, adding constraints to check case etc... is just making up for a
poor initial decision to go with case sensitivity.

This is the biggest pain in the arse in the business intelligence and
reporting area.
Agreed! I worked on a project where we had to compare the address
someone entered with what was in our database. Using case sensitive
searching, "ave" does not match "Ave" or "AVE". Of course, it does not
match "Avenue" either but that is a different animal to skin.
Case Insensitive is how the real world works and that should be the default
for any database 'period'.
I would disagree. Modelling the real world is rarely as simple as black
and white. If one comes up with a hard and fast rule, you'll come up
with an exception to that rule. If you do not like my example above with
proper nouns, then consider this example:

I have a business rule to store my user's password in a table in my
database. That password is composed of characters and numbers.
Furthermore, to increase my password complexity, I require at least one
lower case character and at least one upper case character. Case
sensitivity is now a must. Windows uses case sensitivity in its
passwords as do some applications.

In many cases, the real world does not matter what case you use. But in
some cases, case does matter.
As for Object names it shouldn't matter but case insenitive promotes poor
programming practice.
It respectfully disagree here as well. If object names are allowed to be
case sensitive, then a table with name "Employees" would differ from a
table named "employees" . Two tables with two different names (based on
case), but seem to be representing the same real world entity. Which
table do I use to to get my company's employee information? Object names
being case sensitive can lead to confusion when the only difference
between the objects (on the surface) is the case sensitivity to their
names.
Consider portability to other products and systems.....


So assume that you allow object names to be case sensitive. Then assume
that you port from a RDBMS that allows this to an RDBMS that does not.
You will run in to a problem trying to create that second Employees
table no matter how it is spelled (case-wise). If you truly want to
consider portability, you will make your object names different
regardless of case.

And object names being case insensitive or case sensitive really is not
about programming, but rather database schema design. Maybe it's
splitting hairs, but these are two different things.

Cheers!
Brian
--
=============== =============== =============== =============== =======

Brian Peasland
or********@nosp am.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.
"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
May 12 '06 #13
> Agreed with your example, but in the real world, case can matter for some
data. Is your name "tony", "Tony", or "ToNy"? It does make a difference
when referring to proper nouns. If it didn't make a difference, then "e.
e. cummings" name would not have garnered so much attention throughout the
years.
The default setting should reflect what is the general, and in my experience
and opinion case insensitive is the general, all you are doing is comparing
and building a collation rule based on grammar.

Think through the example, there is no case in speech only gramatical rules.
Is Mac Mc, Mac etc...

Case does matter at times, but is it the general case, what proportion of
the time does it matter 80/10 (not/matters)???
So assume that you allow object names to be case sensitive. Then assume
that you port from a RDBMS that allows this to an RDBMS that does not. You
will run in to a problem trying to create that second Employees table no
matter how it is spelled (case-wise). If you truly want to consider
portability, you will make your object names different regardless of case.


Assume you develop on your oracle system which is case insensitive, the
sloppy developer references the table as Employee and then employee in views
meaning the same table - it will work, now move that implementation to a
case sensitive database and it breaks - thats my point, case insensitive
promotes sloppy programming, I follow Erlands example, all object names and
identifiers are lower case and then you have no problems.

The problems gets worse when programmers start referencing those identifier
names in applications... ..

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Brian Peasland" <or********@nos pam.peasland.ne t> wrote in message
news:Iz******** @igsrsparc2.er. usgs.gov...
As for data Oracle has it completely wrong,


If you do not like the default collation, then change it. Both SQL Server
and Oracle let you change the case sensitivity of its data.
collation should reflect the real world if a salesman shouts out AKA do
they mean aka, Aka, AKa, AKA or what????


Agreed with your example, but in the real world, case can matter for some
data. Is your name "tony", "Tony", or "ToNy"? It does make a difference
when referring to proper nouns. If it didn't make a difference, then "e.
e. cummings" name would not have garnered so much attention throughout the
years.

Sometimes, case does not matter, sometimes it does.
You should not have to rely on doing this data verification yourself,
adding constraints to check case etc... is just making up for a poor
initial decision to go with case sensitivity.

This is the biggest pain in the arse in the business intelligence and
reporting area.


Agreed! I worked on a project where we had to compare the address someone
entered with what was in our database. Using case sensitive searching,
"ave" does not match "Ave" or "AVE". Of course, it does not match "Avenue"
either but that is a different animal to skin.
Case Insensitive is how the real world works and that should be the
default for any database 'period'.


I would disagree. Modelling the real world is rarely as simple as black
and white. If one comes up with a hard and fast rule, you'll come up with
an exception to that rule. If you do not like my example above with proper
nouns, then consider this example:

I have a business rule to store my user's password in a table in my
database. That password is composed of characters and numbers.
Furthermore, to increase my password complexity, I require at least one
lower case character and at least one upper case character. Case
sensitivity is now a must. Windows uses case sensitivity in its passwords
as do some applications.

In many cases, the real world does not matter what case you use. But in
some cases, case does matter.
As for Object names it shouldn't matter but case insenitive promotes poor
programming practice.


It respectfully disagree here as well. If object names are allowed to be
case sensitive, then a table with name "Employees" would differ from a
table named "employees" . Two tables with two different names (based on
case), but seem to be representing the same real world entity. Which table
do I use to to get my company's employee information? Object names being
case sensitive can lead to confusion when the only difference between the
objects (on the surface) is the case sensitivity to their names.
Consider portability to other products and systems.....


So assume that you allow object names to be case sensitive. Then assume
that you port from a RDBMS that allows this to an RDBMS that does not. You
will run in to a problem trying to create that second Employees table no
matter how it is spelled (case-wise). If you truly want to consider
portability, you will make your object names different regardless of case.

And object names being case insensitive or case sensitive really is not
about programming, but rather database schema design. Maybe it's splitting
hairs, but these are two different things.

Cheers!
Brian
--
=============== =============== =============== =============== =======

Brian Peasland
or********@nosp am.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.
"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

May 12 '06 #14
Alexander Kuznetsov wrote:
Latin1_General_ CS_AS will solve some problems, but not all:

SQL Server:

CREATE TABLE t1(c1 CHAR(10) COLLATE Latin1_General_ CS_AS NOT NULL);
INSERT INTO t1 VALUES('AAA');
INSERT INTO t1 VALUES('A_A');

SELECT * FROM T1 order by c1;

c1
----------
A_A
AAA

(2 row(s) affected)

drop table t1;

The same script in Oracle running on UNIX returns rows in a different
order:

C1
----------
AAA
A_A
2 rows selected


Default tables in Oracle, by definition, are heap tables. Expecting
a specific return ordering of rows, unless you explicitly specify
ORDER BY makes no sense.
--
Daniel A. Morgan
University of Washington
da******@x.wash ington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
May 12 '06 #15
Daniel,

you failed to notice a loud and clear ORDER BY clause in my script
SELECT * FROM T1 order by c1;


and decided I'm a newbie and need a lecture on the basics?
;)

May 12 '06 #16
On 12 May 2006 12:46:09 -0700, Alexander Kuznetsov wrote:
Daniel,

you failed to notice a loud and clear ORDER BY clause in my script
SELECT * FROM T1 order by c1;


Hi Allexander,

Maybe keywords are case sensitive in Oracle??

<gd&r>

--
Hugo Kornelis, SQL Server MVP
May 12 '06 #17
Hi Hugo,

that's funny. Yep, in some cases case matters (pun intended), for
instance here is a DB2 UDB palindrome, credits to Serge RIelau

create table where(where char(1))

And the palindrome itself, a valid query:

select where from where select

select
where /*column name*/
from
where /* table name */
select /* table alias */

;)

May 12 '06 #18
Brian Peasland (or********@nos pam.peasland.ne t) writes:
So assume that you allow object names to be case sensitive. Then assume
that you port from a RDBMS that allows this to an RDBMS that does not.
You will run in to a problem trying to create that second Employees
table no matter how it is spelled (case-wise). If you truly want to
consider portability, you will make your object names different
regardless of case.


Yes, having both "Employees" and "employees" in a database is bad idea.
That does not mean that it is a bad idea to have case-sensitive object
names. The issue you raise is fairly hypothetical.

The one that I and Tony raise is real. I can tell from own experience.
My main instances of SQL Server runs a case-sensitive collation. I
frequently copy scripts from newsgroup posts to help people find
solutions. I often have to spend quite some time of cleaning up
inconsistent case usage.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 12 '06 #19
Erland,

on one hand, I would concur: in most cases we need case insensitive
data in the database. For instance, we in our shop uppercase all the
data when we load it into Oracle. On the other hand, I think that case
sensitive indexes may be implemented more efficiently than case
insensitive ones, just because binary (case sensitive) comparisons are
the fastest ones possible. However I am not sure what the performance
gain might be...

May 12 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2964
by: Matik | last post by:
Hello, I think I'd might have a small collation problem. Configuration: Two SQL Srv 2000 SP3 (running on clusters). Booth servers configured with SQL_Latin1_General_CP1_CI_AS collation. On each server, I have one database, which collation is
1
1812
by: John Jayaseelan | last post by:
Hi, The tempdb db is having different collation than the application db. I rebuilt the master db with the appropriate collation after backing up master, model, msdb, appln databases. On restore of the databases (master, model, msdb, appln) from the backup restores the backed up database collation.
2
1804
by: ad | last post by:
The user of my asp.net program use Sql2005 or Sql2005 express as database, both are possible. I have try both version of data base, I found: If I use Sql2005 express, the Data Source in connection string will be ..\SQLEXPRESS, like: Data Source=.\SQLEXPRESS;Initial Catalog=myDB;Integrated Security=True But I use Sql2005 , the Data Source in connection string can be use (local), like:
7
85154
by: Ryan | last post by:
I've stumbled across the above error and am a little stuck. I've just installed SQL2000 (sp3) on my PC and restored a database from our Live server. On a simple Update statement on a #temp table, it fails with the above message. I think I understand what it means and found some old posts suggesting using the following : select name, databasepropertyex(name, 'collation') from master..sysdatabases select serverproperty('collation')
5
3909
by: Mike | last post by:
I'm having trouble accessing SQL2005 Standard Edition as a second instance of SQL Server where the first instance is SQL 2000 Enterprise Edition. I installed SQL 2005 as a named instance "SQL2005". The server is running Windows 2000 SP4 ON A 32-Bit machine. When I look in Services I see the SQL Server (SQL2005), SQL Server Agent (SQL2005) services there. I went into SQL Server Configuration manager and disabled the named pipes protocol...
3
9706
by: aj | last post by:
A few collation questions on SQL Server 2005 SP2, which I'll call SQLS. The default collation for SQLS is apparently SQL_Latin1_General_CP1_CI_AS. I wish to use a variation of this, SQL_Latin1_General_CP1_CS_AI collation, but there is no such collation returned from fn_helpcollations(). Also, if I try to use this collation in a CREATE DATABASE stmt, SQLS yells about it. I see that there is a Latin1_General_CS_AI. What effects are...
3
2899
by: Michael Schöller | last post by:
Hello, First of all english is not my natural language so please fogive me some bad mistakes in gramatic and use of some vocables :). I have a great problem here. Well I will not use it anymore but I want to know why it is as it is ^^. I tried with .NET3.0 but I think it will be the same with 2.0 and 3.5. MSDTC is configured and working.
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10351
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10096
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.