May 18, 2010 at 10:52 am
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! 🙂
May 18, 2010 at 11:01 am
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
May 18, 2010 at 11:18 am
Thanks so much! That will be perfect! 😀
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply