right-string in SQL? How?

From: Bill Parker <bill.parker_at_mns.bt.co.uk>
Date: 1996/06/21
Message-ID: <31CAB442.47C5_at_mns.bt.co.uk>#1/1


Hi,

I need some help writing what I hope is a trivial bit of SQL.

I need to print out the whole of file_name if it is less than 30 chars. wide, else print just the rightmost 30 chars. preceded by ' ...'

But how do I do that?

select if (length(file_name) > 30)
 ' ...'||substr(file_name,length(file_name)-29,30) else
 file_name from table;

Anyhelp gratefully received. Would appreciate e-mail copies as well... this group gets a bit chocker!

Bill

-- 
Boggies are an unattractive but annoying people whose numbers have
decreased rather  precipitously  since the bottom fell out of  the
fairy-tale market.  Slow and sullen,  and yet dull, they prefer to
live simple lives of pastoral squalor.          Bored of the Rings.
Received on Fri Jun 21 1996 - 00:00:00 CEST

Original text of this message