This function is used to manage the alphabet case, which means the first letter of all the words will be in caps.
You may find many scripts for this functionality, but this one is easy to readability and understandability.
Regards,
Vignesh Arulmani
This function is used to manage the alphabet case, which means the first letter of all the words will be in caps.
You may find many scripts for this functionality, but this one is easy to readability and understandability.
Regards,
Vignesh Arulmani
create function fn_mng_alphacase(@inputstring varchar(8000)) returns varchar(8000) as begin declare @returnstring varchar(8000) set @returnstring = lower(@inputstring) declare @i int set @i = ascii('a') while @i <= ascii('z') begin set @returnstring = replace( @returnstring, ' ' + char(@i), ' ' + char(@i-32)) set @i = @i + 1 end set @returnstring = char(ascii(left(@returnstring, 1))-32) + right(@returnstring, len(@returnstring)-1) return @returnstring end go select dbo.fn_mng_alphacase('This is a sample text for verifying the function manage alpha case')