[thelist] SQL Question - Drop the last charector of a string

Tab Alleman talleman at Lumpsum.com
Mon Aug 7 09:34:31 CDT 2006


Are you also familiar with LEFT() and LENGTH()?

: )

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Casey Crookston
> Sent: Monday, August 07, 2006 10:30 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] SQL Question - Drop the last charector of a string
> 
> 
> Using MS-SQL, how would one drop the last character in a string of
> unknown length?  We know that the character is, in this case it's a
> dash: -  But, it could appear more then once in the string and should
> only be replaced with nothing when it is the last character in the
> string.  Two examples:
> 
>  
> 
> "Dealers-" would become "Dealers"
> 
> "Main-New-" would become "Main-New"
> 
>  
> 
> I'm familiar with the "replace" function: replace(string, 'string to
> replace','replacement value').  But this will replace all instances of
> the dash, and not just the last.
> 
>  
> 
> Any ideas?
> 
>  
> 
> Thanks!
> 
>  
> 
> Casey
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 



More information about the thelist mailing list