Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 trim

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-03-18 : 06:00:57
How do I trim off the last 'AND' in a sql string please?
Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-18 : 06:10:25
left(@sql, len(@sql)-3)

Go with the flow & have fun! Else fight the flow
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-18 : 07:43:56
Or, maybe, just don't put it there in the first place.
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-03-18 : 20:26:17
Are you trying to trim off the last three characters if they are 'AND' (e.g. 'England' becomes 'Engl') or are you trying to remove the last occurance of 'and' anywhere in the string (e.g., 'England and Wales' becomes 'England Wales')?

HTH

=================================================================
In order to improve the mind, we ought less to learn than to contemplate.
-Rene Descartes, philosopher and mathematician (1596-1650)
Go to Top of Page
   

- Advertisement -