Thursday, March 22, 2012

case sensitive

Is there a way to set a case sensitive db to case insenstive.
Thanks
FrankThis is a multi-part message in MIME format.
--050904010907080809040206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
ALTER DATABASE MyDB COLLATE <collation_name>
(see BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp)
For example:
ALTER DATABASE MyDB COLLATE Latin1_General_CI_AS
Note, this can be overridden at the column level and even during query
evaluations. For instance, these 2 queries return different result sets:
select * from Northwind.dbo.Orders where ShipCountry COLLATE
Latin1_General_CS_AS = 'germany'
select * from Northwind.dbo.Orders where ShipCountry COLLATE
Latin1_General_CI_AS = 'germany'
--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
Frank Ashley wrote:
>Is there a way to set a case sensitive db to case insenstive.
>
>Thanks
>Frank
>
>
--050904010907080809040206
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>ALTER DATABASE MyDB COLLATE <collation_name><br>
<br>
(see BOL:
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp</a>)<br>">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp</a>)<br>
<br>
For example:<br>
</tt>
<blockquote><tt>ALTER DATABASE MyDB COLLATE Latin1_General_CI_AS</tt><br>
</blockquote>
<tt><br>
Note, this can be overridden at the column level and even during query
evaluations. For instance, these 2 queries return different result
sets:<br>
</tt>
<blockquote><tt>select * from Northwind.dbo.Orders where ShipCountry
COLLATE Latin1_General_CS_AS = 'germany'</tt><br>
<tt>select * from Northwind.dbo.Orders where ShipCountry COLLATE
Latin1_General_CI_AS = 'germany'</tt><br>
</blockquote>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font> </span><b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"> <font face="Tahoma"
size="2">|</font><i><font face="Tahoma"> </font><font face="Tahoma"
size="2"> database administrator</font></i><font face="Tahoma" size="2">
| mallesons</font><font face="Tahoma"> </font><font face="Tahoma"
size="2">stephen</font><font face="Tahoma"> </font><font face="Tahoma"
size="2"> jaques</font><font face="Tahoma"><br>
</font><b><font face="Tahoma" size="2">T</font></b><font face="Tahoma"
size="2"> +61 (2) 9296 3668 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2"> F</font></b><font face="Tahoma" size="2"> +61
(2) 9296 3885 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2">M</font></b><font face="Tahoma" size="2"> +61
(408) 675 907</font><br>
<b><font face="Tahoma" size="2">E</font></b><font face="Tahoma" size="2">
<a href="http://links.10026.com/?link=mailto:mike.hodgson@.mallesons.nospam.com">
mailto:mike.hodgson@.mallesons.nospam.com</a> |</font><b><font
face="Tahoma"> </font><font face="Tahoma" size="2">W</font></b><font
face="Tahoma" size="2"> <a href="http://links.10026.com/?link=/">http://www.mallesons.com">
http://www.mallesons.com</a></font></span> </p>
</div>
<br>
<br>
Frank Ashley wrote:
<blockquote cite="mideu3K34GcFHA.456@.TK2MSFTNGP09.phx.gbl" type="cite">
<pre wrap="">Is there a way to set a case sensitive db to case insenstive.
Thanks
Frank
</pre>
</blockquote>
</body>
</html>
--050904010907080809040206--|||... also note that ALTER DATABASE does not change collation for existing tables. You need to use
ALTER TABLE ... ALTER COLUMN for that.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message
news:upXygsIcFHA.3040@.TK2MSFTNGP14.phx.gbl...
> ALTER DATABASE MyDB COLLATE <collation_name>
> (see BOL:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp)
> For example:
> ALTER DATABASE MyDB COLLATE Latin1_General_CI_AS
>
> Note, this can be overridden at the column level and even during query
> evaluations. For instance, these 2 queries return different result sets:
> select * from Northwind.dbo.Orders where ShipCountry COLLATE
> Latin1_General_CS_AS = 'germany'
> select * from Northwind.dbo.Orders where ShipCountry COLLATE
> Latin1_General_CI_AS = 'germany'
> --
> *mike hodgson* |/ database administrator/ | mallesons stephen jaques
> *T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
> *E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
>
> Frank Ashley wrote:
>>Is there a way to set a case sensitive db to case insenstive.
>>
>>Thanks
>>Frank
>>
>>
>|||So I need to iterate through all the existing tables and columns using ALTER
TABLE ... ALTER COLUMN. Is that what you mean?
Thanks
Frank
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23D%23cB3KcFHA.1148@.tk2msftngp13.phx.gbl...
> ... also note that ALTER DATABASE does not change collation for existing
> tables. You need to use ALTER TABLE ... ALTER COLUMN for that.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message
> news:upXygsIcFHA.3040@.TK2MSFTNGP14.phx.gbl...
>> ALTER DATABASE MyDB COLLATE <collation_name>
>> (see BOL:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp)
>> For example:
>> ALTER DATABASE MyDB COLLATE Latin1_General_CI_AS
>>
>> Note, this can be overridden at the column level and even during query
>> evaluations. For instance, these 2 queries return different result sets:
>> select * from Northwind.dbo.Orders where ShipCountry COLLATE
>> Latin1_General_CS_AS = 'germany'
>> select * from Northwind.dbo.Orders where ShipCountry COLLATE
>> Latin1_General_CI_AS = 'germany'
>> --
>> *mike hodgson* |/ database administrator/ | mallesons stephen jaques
>> *T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
>> *E* mailto:mike.hodgson@.mallesons.nospam.com |* W*
>> http://www.mallesons.com
>>
>> Frank Ashley wrote:
>>Is there a way to set a case sensitive db to case insenstive.
>>
>>Thanks
>>Frank
>>
>>
>|||Yes. Not fun, especially as you can only do one column at a time. Also, you need to remove indexes
(including PK and UQ constraints) and possibly foreign keys (don't remember). It is documented in
Books Online.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Frank Ashley" <aa@.aa.com> wrote in message news:OadX2ZLcFHA.3712@.TK2MSFTNGP09.phx.gbl...
> So I need to iterate through all the existing tables and columns using ALTER TABLE ... ALTER
> COLUMN. Is that what you mean?
> Thanks
> Frank
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:%23D%23cB3KcFHA.1148@.tk2msftngp13.phx.gbl...
>> ... also note that ALTER DATABASE does not change collation for existing tables. You need to use
>> ALTER TABLE ... ALTER COLUMN for that.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message
>> news:upXygsIcFHA.3040@.TK2MSFTNGP14.phx.gbl...
>> ALTER DATABASE MyDB COLLATE <collation_name>
>> (see BOL:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_4e5h.asp)
>> For example:
>> ALTER DATABASE MyDB COLLATE Latin1_General_CI_AS
>>
>> Note, this can be overridden at the column level and even during query
>> evaluations. For instance, these 2 queries return different result sets:
>> select * from Northwind.dbo.Orders where ShipCountry COLLATE
>> Latin1_General_CS_AS = 'germany'
>> select * from Northwind.dbo.Orders where ShipCountry COLLATE
>> Latin1_General_CI_AS = 'germany'
>> --
>> *mike hodgson* |/ database administrator/ | mallesons stephen jaques
>> *T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
>> *E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
>>
>> Frank Ashley wrote:
>>Is there a way to set a case sensitive db to case insenstive.
>>
>>Thanks
>>Frank
>>
>>
>>
>

No comments:

Post a Comment