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 |
penumatsa
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-09-21 : 08:46:56
|
I am trying to write a query to find the words in a column which are in upper case and then find out the distinct ones among them. I know that i can use the DISTINCT function to get the unique ones, but how to extract the ones which are in upper case. I am not talking about words which start with upper case, but the whole word is in upper case. Any help is appreciated.suresh penumatsa |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-21 : 08:55:25
|
[code]declare @test table (word varchar(10))insert @testselect 'Peso' union allselect 'peso' union allselect 'PESO'select word, case when UPPER(word) = word then 1 else 0 end [upper function], Case when UPPER(word) COLLATE Finnish_Swedish_CS_AS = word COLLATE Finnish_Swedish_CS_AS then 1 else 0 end [collate keyword], case when cast(upper(word) as varbinary) = cast(word as varbinary) then 1 else 0 end [cast varbinary]from @test[/code]Peter LarssonHelsingborg, Sweden |
 |
|
penumatsa
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-09-21 : 09:10:07
|
Thanks Peso.All i am trying to do is to get the words which are in upper case. The data is there in the Table. What's that Finnish swedish stuff. I am in the USA and so that does not make sense. Also what is that with 'Peso'.suresh penumatsa |
 |
|
penumatsa
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-09-21 : 09:15:06
|
I ran that query and it returns all the rows from the table. That is not that i wanted.suresh penumatsa |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-09-21 : 09:25:22
|
how about if you first look up collate in BOL?second it's test data. do you really expect to get a solutions that you can simply cut and paste without modifying it?to be able to solve a problem you have to understand the solution that has been provided.Go with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-21 : 09:57:50
|
quote: Originally posted by penumatsa I ran that query and it returns all the rows from the table. That is not that i wanted.
Did you even notice that some rows were flagged differently?You have to rewrite my suggestion and put the CASE clause to a WHERE statement.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|