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 |
sippon77
Starting Member
13 Posts |
Posted - 2005-10-27 : 00:33:26
|
How can i figure out..if a string is completely in uppercase? or if a string is not in title case (ie: The first letter of a word is in Uppercase and remaining are in lower case).Thanks in advance. |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-27 : 02:01:06
|
It would be better if you can do this in front end since there are lots of ready made In built functions for the same. But you can trying using ASCII functions of the SQL for the same. Hope the following scripts helps you.. For checking the Upper Declare @var Varchar(1000)Set @Var = 'SOMEVALUE'IF ASCII(@Var) = ASCII(Upper(@var))Print 'Its in the Upper Case' ElsePrint 'Its Not in the upper CAse' --- for the title caseIF ASCII(LEft(@Var,1)) = ASCII(Upper(Left(@Var,1)))Print 'its the Title Case'Else Print 'Its Not The Title Case. 'Complicated things can be done by simple thinking |
 |
|
Kristen
Test
22859 Posts |
Posted - 2005-10-27 : 02:08:41
|
SELECT *FROM MyTableWHERE UPPER(MyColumn) = MyColumn COLLATE Latin1_General_BINKristen |
 |
|
Hunglech
Starting Member
16 Posts |
Posted - 2005-10-27 : 02:12:54
|
You can useIF @Var COLLATE Latin1_General_BIN = UPPER(@Var)RETURN 1ELSERETURN 0 |
 |
|
Hunglech
Starting Member
16 Posts |
Posted - 2005-10-27 : 02:16:43
|
Ah, Like Kristen'Solution |
 |
|
Kristen
Test
22859 Posts |
Posted - 2005-10-27 : 02:27:16
|
Of all of the BINary collations, in all of SQL server, in all of SQL Team ... you choose mineWith apologies to Humphrey Bogart and Casablanca!Kristen |
 |
|
|
|
|