Possible Duplicate:
SQL Server: Make all UPPER case to Proper Case/Title Case
if i have a string "HELLO WORLD"
How can i lowercase every letter after the first one but keep the camel casing so: i get:
Hello World
Possible Duplicate:
SQL Server: Make all UPPER case to Proper Case/Title Case
if i have a string "HELLO WORLD"
How can i lowercase every letter after the first one but keep the camel casing so: i get:
Hello World
If possible, I would try to do this on the client personally... But you could try this:
CREATE FUNCTION [dbo].[CamelCase]
(@Str varchar(8000))
RETURNS varchar(8000) AS
BEGIN
DECLARE @Result varchar(2000)
SET @Str = LOWER(@Str) + ' '
SET @Result = ''
WHILE 1=1
BEGIN
IF PATINDEX('% %',@Str) = 0 BREAK
SET @Result = @Result + UPPER(Left(@Str,1))+
SubString (@Str,2,CharIndex(' ',@Str)-1)
SET @Str = SubString(@Str,
CharIndex(' ',@Str)+1,Len(@Str))
END
SET @Result = Left(@Result,Len(@Result))
RETURN @Result
END