Monday, March 19, 2012

Case

Being new to SQL Server and comming from an Oracle environment...
When I write queries for Oracle, I have to ensure that my queries are
written to be case sensitive. Now when I write those same queries in SQL
(using .Net) it does not appear to be case sensitive. Is this a database
setting or some setting in .Net which is causing case to be ignored?Hi,
You SQL Server collation must be set as CASE INSENSITIVE.. In this case
there is not difference betweeen Upper and
Lower case characters. If your collation is set to Case Sensitive then you
will have the difference between Upper and Lower case.
See the collation of the server using below command:-
select SERVERPROPERTY ( 'collation' )
Thanks
Hari
SQL Server MVP
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:D18CBCF9-EA51-4F72-A70D-61C86378C036@.microsoft.com...
> Being new to SQL Server and comming from an Oracle environment...
> When I write queries for Oracle, I have to ensure that my queries are
> written to be case sensitive. Now when I write those same queries in SQL
> (using .Net) it does not appear to be case sensitive. Is this a database
> setting or some setting in .Net which is causing case to be ignored?
>|||Hari Prasad wrote:
> Hi,
> You SQL Server collation must be set as CASE INSENSITIVE.. In this case
> there is not difference betweeen Upper and
> Lower case characters. If your collation is set to Case Sensitive then you
> will have the difference between Upper and Lower case.
> See the collation of the server using below command:-
> select SERVERPROPERTY ( 'collation' )
> Thanks
> Hari
> SQL Server MVP
>
> "Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
> news:D18CBCF9-EA51-4F72-A70D-61C86378C036@.microsoft.com...
> > Being new to SQL Server and comming from an Oracle environment...
> > When I write queries for Oracle, I have to ensure that my queries are
> > written to be case sensitive. Now when I write those same queries in SQL
> > (using .Net) it does not appear to be case sensitive. Is this a database
> > setting or some setting in .Net which is causing case to be ignored?
> >
It depends on collation of your SQL Server.
In your collation if you found CI then that collation is
case-insensitive and if it is CS then it is case-sensitive.
Try this
select * from ::fn_helpcollations()
where name = serverproperty('collation')
Regards
Amish Shah

No comments:

Post a Comment