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

Casey Crookston caseyc at IntelliSoftmn.com
Mon Aug 7 09:43:22 CDT 2006


As per this tutorial, yes:

http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__
BookTextView/31275;pt=30441


Still having trouble with the actual query.



-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tab Alleman
Sent: Monday, August 07, 2006 9:35 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] SQL Question - Drop the last charector of a
string

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 ! 
> 
-- 

* * 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