[thelist] SQL Question - Drop the last charector of a string
Rob Smith
rob.smith at lexjet.com
Mon Aug 7 09:40:10 CDT 2006
>how would one drop the last character in a string of unknown length?
Hi Casey,
In VBScript, I'd write it something like:
SomeVar = left(SomeVar,len(SomeVar)-1)
In SQL, it'd be something like,
SELECT left(dept_name,len(dept_name)-1) as dept_name
FROM myTable
If you need the left on a conditional basis, then use a select case
statement. Your hyphen detection might look like:
SELECT right(dept_name,1)
FROM myTable
Rob Smith
LexJet
rob.smith at lexjet.com
http://www.lexjet.com
(800)453-9538
(941)330-1210 Int'l
(941)330-1220 Fax
1680 Fruitville Road, 3rd Floor
Sarasota, FL 34236
More information about the thelist
mailing list