473,804 Members | 2,124 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 16502
Alexander Kuznetsov (AK************ @hotmail.COM) writes:
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...


Note that binary <> case-sensitive in SQL Server. That is, a binary
collation is case-sensitive, however the reverse does not apply. My
standard collation is Finnish_Swedish _CS_AS, and it's binary. It co-
sorts V and W, Y and Ü.and sorts ÅÄÖ in the right order.
--
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 #21
Alexander Kuznetsov wrote:
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?
;)


Not sure I saw the original script. But I did see a statement
indicating different behaviour between Oracle and SQL Server.
With an ORDER BY the result set is identical.
--
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 #22
> With an ORDER BY the result > set is identical.

Can you post versions of SQL Server and Oracle and operating systems
for which they are identical?

In fact it is a well known little obstacle in migrations between
Oracle and SQL Server. More to the point, immediately before posting I
ran the script and cut and pasted my results. Repeat, the results as
harvested from 2 live servers several hours ago are different:

SELECT * FROM T1 order by c1;

SQL Server:

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

(2 row(s) affected)

drop table t1;

The same script in Oracle running on UNIX (HP-UX) returns rows in a
different
order:

C1
----------
AAA
A_A

May 13 '06 #23
> Note that binary <> case-sensitive in SQL Server.

yes, but you need < and > comparisons to navigate an index. I guess
Finnish_Swedish _CS_AS collation is implemened as a function. As such,
it probably works a little bit slower than raw bytes comparison,
probably no big deal, just a little bit slower. Makes sence?

May 13 '06 #24
Alexander Kuznetsov (AK************ @hotmail.COM) writes:
Note that binary <> case-sensitive in SQL Server.


yes, but you need < and > comparisons to navigate an index. I guess
Finnish_Swedish _CS_AS collation is implemened as a function. As such,
it probably works a little bit slower than raw bytes comparison,
probably no big deal, just a little bit slower. Makes sence?


Exactly how Finnish_Swedish _CS_AS is implemented I don't know, but
I don't think the difference is smaller with regards to Finnish_Swedish _BIN
than to Finnish_Swedish _CI_AI.
--
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 13 '06 #25
Thank you all for your commencts on this - I didn't know it is so common and
relatively painful issue. Certainly, I wasn't expecting it, that ther eis no
easy solution to this.

My opinion is that table and column name should be insensitive by pretty
much 80/20 or yet better 99/1 rule (it's a new one:-), the 1 only when we
are looking for readability of the object or column name. To the contrary,
we always need to read the data (actual information) from these tables and
columns, so data got to be sensitive. I don't think people enjoy seeing
there names in funny cases like mIKe vs Mike, let alone that e.e...example
which I'm not aware of.

More importatntly, if it is such a pain then why not provide this as an
option in collation; if SQL server can give you so many other options, this
one can also be included - specially when SQL server is not the leader in DB
category.

I think adopting a standard is good - so I'll be forced to use
SQL_Latin1_Gene ral_CP1_CS_AS to keep all sensitive across the board to avoid
confusions.

chao,
Nasir


"Alexander Kuznetsov" <AK************ @hotmail.COM> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
With an ORDER BY the result > set is identical.


Can you post versions of SQL Server and Oracle and operating systems
for which they are identical?

In fact it is a well known little obstacle in migrations between
Oracle and SQL Server. More to the point, immediately before posting I
ran the script and cut and pasted my results. Repeat, the results as
harvested from 2 live servers several hours ago are different:

SELECT * FROM T1 order by c1;

SQL Server:

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

(2 row(s) affected)

drop table t1;

The same script in Oracle running on UNIX (HP-UX) returns rows in a
different
order:

C1
----------
AAA
A_A

May 15 '06 #26
I think Nasir you've already been told several times how you can do this
with SQL Server.

I don't see a problem setting the database collation to case insensitive and
specifying at a column level the case sensitive option - you need only do it
once at CREATE TABLE time and its no more hassle then writing NOT NULL or
NULL, its COLLATE <collation name>.

I'd suggest you think this through a lot more, consider the problems with
data being case sensitive.

When you type in 'sql server' into google does it only bring back those
results that had 'sql server' in them or do they bring back the 'SQL Server'
ones too, or perhaps Oracle users have some mystical power that allows them
to sense correct case and type it correctly every time....

There is no benefit to case sensitivity unless you are enforcing it in the
real world and to my experience (19+ years of development) there are seldom
cases for case sensitive data.

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Nasir" <nm*****@prosrm .com> wrote in message
news:44******** **************@ news.twtelecom. net...
Thank you all for your commencts on this - I didn't know it is so common
and relatively painful issue. Certainly, I wasn't expecting it, that ther
eis no easy solution to this.

My opinion is that table and column name should be insensitive by pretty
much 80/20 or yet better 99/1 rule (it's a new one:-), the 1 only when we
are looking for readability of the object or column name. To the contrary,
we always need to read the data (actual information) from these tables and
columns, so data got to be sensitive. I don't think people enjoy seeing
there names in funny cases like mIKe vs Mike, let alone that e.e...example
which I'm not aware of.

More importatntly, if it is such a pain then why not provide this as an
option in collation; if SQL server can give you so many other options,
this one can also be included - specially when SQL server is not the
leader in DB category.

I think adopting a standard is good - so I'll be forced to use
SQL_Latin1_Gene ral_CP1_CS_AS to keep all sensitive across the board to
avoid confusions.

chao,
Nasir


"Alexander Kuznetsov" <AK************ @hotmail.COM> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
With an ORDER BY the result > set is identical.


Can you post versions of SQL Server and Oracle and operating systems
for which they are identical?

In fact it is a well known little obstacle in migrations between
Oracle and SQL Server. More to the point, immediately before posting I
ran the script and cut and pasted my results. Repeat, the results as
harvested from 2 live servers several hours ago are different:

SELECT * FROM T1 order by c1;

SQL Server:

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

(2 row(s) affected)

drop table t1;

The same script in Oracle running on UNIX (HP-UX) returns rows in a
different
order:

C1
----------
AAA
A_A


May 15 '06 #27
Tony Rogerson (to**********@s qlserverfaq.com ) writes:
I don't see a problem setting the database collation to case insensitive
and specifying at a column level the case sensitive option - you need
only do it once at CREATE TABLE time and its no more hassle then writing
NOT NULL or NULL, its COLLATE <collation name>.


Depends on how many tables you have. :-)

And you would have to set the server collation to be case-sensitive,
or else temp tables will be painful.


--
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 15 '06 #28

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

Similar topics

3
2965
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
1813
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
9715
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
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10354
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
10097
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...
1
7642
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...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3835
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.