Query to remove middle initial from name

M

MARIA

My table contains employee names some with middle initial,
some without: "SMITH, BOB K"

I need to get rid of the middle initial and space. Can
anyone help me? I believe I need to use a LEFT or RIGHT
but am not sure.

thanks.
 
P

Phobos

If you want an UPDATE query to make the changes permanent:

UPDATE MyTable SET MyTable.MyField = Left([MyField],Len([MyField])-2)
WHERE ((Left(Right([MyField],2),1)=" "));

Or if you want a calculated field in a SELECT query:

SELECT IIf(Left(Right([MyField],2),1)="
",Left([MyField],Len([MyField])-2),[MyField]) AS NewField
FROM MyTable;

P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top