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 |
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-08-03 : 19:03:05
|
| Hi friendsI have a table (one column staffid) with data like followingstaffid------AABen BevBWCarriCHRIShow can i write query that returns staffids in upper case?i mean AA,BW,CHRIS staffidsCheers |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-08-03 : 19:18:45
|
| SELECT UPPER(staffid) FROM table |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-08-03 : 19:24:42
|
| sorry seems i asked wrong question.i want staffids that r in uppercase only.if u see my data in the previous not all staffids in upper casei mean my query should return AA,BW,CHRIS staffids only Cheers |
 |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-08-03 : 19:39:17
|
| You can use tell SQL to use a case sensitive collation to make the comparison:select * from mytablewhere staffid COLLATE Latin1_General_BIN = upper(staffid)Or for a less efficient method:select * from mytablewhere BINARY_CHECKSUM(Upper(staffid)) = BINARY_CHECKSUM(staffid)(Sometimes you can not mix collation sets within a single query and Binary_checksum will always work but it is slower)--Ken"Knowledge is a process of piling up facts; wisdom lies in their simplification." |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-08-03 : 19:43:14
|
| Ken you are a Genious.Both queries worked beautifully.Thank you very muchCheers |
 |
|
|
|
|
|