| Author |
Topic |
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 05:49:38
|
Greetings,How would you check to see if a string is all in upper case?Thank in advance.------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution  |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-28 : 06:29:50
|
| Your solution would be to use collate.The mean old dba and myself had a discussion on this just yesterday.Try something like this:create table #test(iden INT Identity(1,1), descr varchar(10), col3 varchar(10))insert into #test VALUES('NO','axa')insert into #test VALUES('NO', 'AxA')insert into #test VALUES('YES', 'AXA')insert into #test VALUES('NO', 'AXa')insert into #test VALUES('NO','axa')insert into #test VALUES('NO','AxA')insert into #test VALUES('NO','AXa')insert into #test VALUES('YES','AXA')insert into #test VALUES('NO','axa')select * from #testwhere UPPER(col3) = Col3 COLLATE SQL_EBCDIC037_CP1_CS_ASor look at yesterdays thread (all about using collate)http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=37938Duane. |
 |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 06:46:43
|
So I take it that this particular collatio is case sensetive?------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-28 : 06:51:38
|
| Yes!The CS in "COLLATE SQL_EBCDIC037_CP1_CS_ASmeans case sensitiveDuane. |
 |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 06:53:02
|
but why choose this particular one I mean can I use any one with a CS?------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-28 : 07:01:41
|
| Yip I reckon you probably can.If you run sp_helpsort this will return the existing collate sort order for the server.From that you will get a better understanding of what the cp1, cs, as etc acronyms mean.Duane. |
 |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 08:30:41
|
Much appreciated my south african friend. BTW, how is the golf going these days?Playing after work today so that should be a good laugh ------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2004-07-28 : 08:36:04
|
| I'd be inclined to use the case-sensitive version of the collation that the column is using. Otherwise, what's the point of having specified the collation of the column in the first place?Certainly don't use a collation with a different character set, or your comparison can go wrong where the characters in the column get downgraded. |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-28 : 08:40:14
|
| I'm Playing on Sunday.BTW Where on Earth is Garden of Sakuntala ???Duane. |
 |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 08:43:16
|
Arnold, Good point. I actually used the DatabasePropertyEX function to get the collation of my database then replaced _CI_ with _CS_ to get the correct sort order. I think Duane was probably using his South African collation in his example Thanks.------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution |
 |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2004-07-28 : 08:46:02
|
quote: Originally posted by ditch I'm Playing on Sunday.BTW Where on Earth is Garden of Sakuntala ???Duane.
Dreamland...... 3rd junnction off the high way to hell------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destrcution |
 |
|
|
|