View Full Version : Display only part of field


Steve Kipping
02-26-2002, 02:39 PM
We have a field of manhole labels that consist of "district#-manhole#". I want to truncate the "district#-" and leave only the manhole number.

Example:
7-345 becomes 345 or
12A-17 becomes 17

Any ideas?
Thanks,
SKK

DBL
02-26-2002, 03:01 PM
This is just an observation and not the answer I'm afraid. Your table design should probably be set up so that your district # and manhole # are divided into two separate fields which you could then join to make look like, for example 7-345.

RV
02-27-2002, 12:02 AM
Steve,

I agree with DBL.
However, this is what you can do if you want to update your table data:

UPDATE <yourTableName>
SET
<yourTableName>.DistrictManhole=Mid(<yourTableName >.DistrictManhole, Instr(<yourTableName>.DistrictManhole, "-")+1)
;

If you just want to show truncated results, you this:

SELECT Mid(<yourTableName>.DistrictManhole, Instr(<yourTableName>.DistrictManhole, "-")+1)
FROM <yourTableName>;

Suc6,

RV

Steve Kipping
02-27-2002, 07:31 AM
Thanks for your comments. Your suggestion of splitting the field up is exactly what I had in mind. This database is left over from years ago.

Thanks again,
SKK