Expression Builder and Update Query

G

Guest

I am trying to create a query that looks at a single table with a field call
region. The region field begins with the letters SD, format is "SD REGION -
CITY". I would like to remove the SD and CITY from the field leaving no
spaces but only the REGION. I tried to use QUERY Builder with Expression
Builder....here's my valiant stab at it.

UPDATE [X-WMS] SET [X-WMS].REGION_NAME = Replace("SD","",1,1,2);
 
G

Guest

Try this if the field always starts with 'SD ' and only has ' - ' before the
city.

UPDATE [X-WMS] SET [X-WMS].REGION_NAME = Left(Replace([X-WMS].REGION_NAME],
"SD ",""), InStr(Replace([X-WMS].REGION_NAME], "SD ",""), " - ") -3) ;
 

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