Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Proper Case Only If All Caps


Proper Case Only If All Caps

Author
Message
lk-681111
lk-681111
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 423
Hello:

I have a table with a FirstName and LastName field, about 85% of which were entered into the database in proper case (e.g., John Smith, D'Angelo Martin, Jane LaPierre). The rest of the records were entered in all caps. I have a function built to proper case the fields, but I only want to use the function on the records that are in all caps; I want to leave the ones that are already proper cased alone. Does anyone know if there's a way to determine in T-SQL whether a field is in all caps?

Thanks! Smile
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14942 Visits: 38937
some great code suggestions
from a similar thread where someone needed to detect if lower case/upper case character exists:
http://www.sqlservercentral.com/Forums/Topic800271-338-1.aspx


this would check if the string is all UPPER:

DECLARE @string VARCHAR(10)

SET @string = 'Sarat'
SELECT
CASE
WHEN @string = upper (@string) COLLATE Latin1_General_CS_AI
THEN 'All upper case found' ELSE 'Mixed or lower Case found'
END



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

lk-681111
lk-681111
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 423
Thanks so much! That will be perfect! :-D
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search