Link to home
Start Free TrialLog in
Avatar of Mehram
MehramFlag for Pakistan

asked on

To select designation all in capital letters

SQL Server 2005

Please see code snippet
select top 10 desig_code, designation
from designation

and result is
desig_code	designation
0603	Add. G.M. (Sales & Markt.)
0601	A F M
0606	Assistant Information Technolo
0602	Accounts Manager
0607	Assistant Fiter
0225	SALES OFFICER
0608	Assistant Purchaser
0604	Advisor
0605	Anode Caster
0610	Asst. Dty. General Manager
0520	LABOUR OFFICER
0609	Assistant Turner

I want to select only those designation which are all in 
capital letters.

In this case the result would be
desig_code	designation
0225	SALES OFFICER
0520	LABOUR OFFICER
0601	A F M

Open in new window

Avatar of RiteshShah
RiteshShah
Flag of India image

you have to use user defined function.

http://www.sql-server-helper.com/functions/initcap.aspx
or may be UPPER function of SQL Server like this:



select top 10 desig_code, designation
from designation

and result is
UPPER(desig_code)      designation
0603    Add. G.M. (Sales & Markt.)
0601    A F M
0606    Assistant Information Technolo
0602    Accounts Manager
0607    Assistant Fiter
0225    SALES OFFICER
0608    Assistant Purchaser
0604    Advisor
0605    Anode Caster
0610    Asst. Dty. General Manager
0520    LABOUR OFFICER
0609    Assistant Turner

I want to select only those designation which are all in 
capital letters.

In this case the result would be
desig_code      designation
0225    SALES OFFICER
0520    LABOUR OFFICER
0601    A F M

Open in new window

ohh sorry, misread your question.
ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mehram

ASKER

Thanks to all experts