Nicholson, Karen
knicholson at gpsx.net
Wed Jul 30 07:53:14 CDT 2003
Or how about this one - this seems to take into account the punctuation mark. create FUNCTION ReturnCasedString (@Instr varchar(8000)) RETURNS varchar(8000) AS BEGIN If @Instr is Null or Len(@instr)=0 or @instr=space(len(@instr) Return @Instr Declare @Workstr varchar(8000) Declare @Punct varchar(20) Declare @PunctLen int Declare @StrPos int Declare @PunctPos int Declare @PunctChar char(1) Set @Punct=''' ,([{<' Set @punctLen=len(@punct) Set @WorkStr=LOWER(@Instr) Set @PunctPos=1 While @PunctPos <= @PunctLen Begin Set @punctChar=substring(@punct, at punctPos,1) set @StrPos = charindex (@punctChar, @WorkStr, 1) if @StrPos>0 Begin While @strpos > 0 begin Set @charpos = @strpos + 1 If @charpos <= @punctlen begin Set @substring(@workstr,charpos),1) = UPPER(@substring(@workstr,charpos),1)) end Set Strpos=charindex(@punctchar, at workstr, at charpos) end end Set @punctPos=@PunctPos+1 End return @Workstr END -----Original Message----- From: Billy Pang [mailto:tuxedo_man at hotmail.com] Sent: Tuesday, July 29, 2003 10:07 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer]Proper case? Is there a "proper case" function within SQL Server? I know that there is UPPER and LOWER, but what will help me convert the following: "the quick brown fox jumped. it is over for the lazy dog." to "The quick brown fox jumped. It is over for the lazy dog." Thanks in advance, Billy _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com