Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Dev Null
Starting Member
39 Posts |
Posted - 2007-08-20 : 20:57:34
|
| Ok, heres my problem: I want to install a database as part of my tool on the user's pre-existing SQL Server instance. I don't just want to override their default collation - if I do my job right, the tool has value to people from more than one country and/or language - but I need it to be case-sensitive, because the data I'm manipulating is as well.I think I've found a way to make it work, but its horrible! I end up getting the server default collation from SERVERPROPERTY('Collation'), parsing it as a string to see if it conforms to the naming convention that indicates a case-insensitive collation (*_CI_A[IS]*), convert that to one which would be case-sensitive by changing the CI to CS, and look up that name to see if it exists in fn_helpcollations(). Bleah! I'm relying on the naming convention being followed - which I don't trust in the least - and in some cases the case-sensitive equivalent doesn't exist anyways, and I have to fall back on a default.Surely there is some better way to specify a database or column as case-sensitive, without having to override the choice of code page, the rest of the sort order, etc? Yet I can't find anything in the docs, or the archives on here... any ideas?Thanks, - rob. |
|
|
pootle_flump
1064 Posts |
Posted - 2007-08-21 : 03:52:25
|
| Maybe I am misunderstanding you but why can't you just specify the COLLATE clause in the CREATE DATABASE statement? Or use the COLLATE clause for the relevent columns in your CREATE TABLE statements? |
 |
|
|
Dev Null
Starting Member
39 Posts |
Posted - 2007-08-21 : 14:30:55
|
| Well I can if I can work out which collation to use... The problem is I want to use the user's preference for everything else - Cyrillic characters, not counting accents, etc. - and only change their default from case-insensitive to case sensitive. But SQL Server seems to have all of these mostly independent variables wrapped up in the single construct of a collation, without any sensible way of turning one on/off and leaving the others alone...Unless of course I've missed something, which is what I'm hoping. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-21 : 14:39:55
|
| you'll have to do it the way you're doing it now_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
mskaditya
Starting Member
2 Posts |
Posted - 2007-08-30 : 04:19:03
|
| I happened to face a similar problem and could not find any other solution than this. you can preferably execute a alter command for the database to change the value pulling the Collation String from a config file. if the string changes in futre you just need to change that. though this is not efficient will not let you need to change much code in case of change in the SQL Server settings...did this help...-Aditya |
 |
|
|
|
|
|
|
|