Can I use SQL trim function for this?

S

Stuart E. Wugalter

Dear Access Gurus:

I have a column of data that looks similar to this:

AR132-34C
CA24-X1
BRCA29-7Z1

I want to "chop off" the dash and everything else following it so that the
resulting column will look like this:

AR132
CA24
BRCA29

Can I do this using the TRIM function in SQL. I am using Microsoft Access
2002 and am not familiar with Visual Basic.

Thanks in advance for your consideration.

Stuart E. Wugalter
 
D

Duane Hookom

I'm not sure how Trim() would work in SQL (Server) since I would expect to
use CharIndex().

In Access queries, you can use:
Left([YourField], Instr([YourField],"-")-1)
 
Top