title: How to Replace Multiple Characters in Access SQL?
body: <p>I'm a novice at SQL, so hopefully someone can spell this out for me.   I tried following the "Replace Multiple Strings in SQL Query" posting, but I got stuck.</p>
  
  <p>I'm trying to do the same thing as the originator of the above posting but with a different table and different fields. Let's say that the following field "<code>ShiptoPlant</code>" in table "<code>BTST</code>" has three records (my table actually has thousands of records)...</p>
  
  <p><strong>Table Name: BTST</strong></p>
  
  <pre><code>   ---------------
     | ShiptoPlant |
     | ----------- |
     | Plant #1    |
     | Plant - 2   |
     | Plant/3     |
     ---------------
  </code></pre>
  
  <p>Here's what I'm trying to type in the SQL screen:</p>
  
  <pre><code>SELECT CASE WHEN ShipToPlant IN ("#", "-", "/") Then ""
  ELSE ShipToPlant END FROM BTST;
  </code></pre>
  
  <p>I keep getting the message (Error 3075)...</p>
  
  <pre><code>"Syntax error (missing operator) in query expression 
  'CASE WHEN ShiptoPlant IN (";","/"," ") Then "" ELSE ShipToPlant END'."
  </code></pre>
  
  <p>I want to do this operation for every character on the keyboard, with exception of <code>"*"</code> since it is a wildcard.</p>
  
  <p>Any help you could provide would be greatly appreciated!</p>
  
  <p><strong>EDIT: Background Information added from the comments</strong></p>
  
  <p>I have collected line-item invoice-level data from each our 14 suppliers for the 2008 calendar year. I am trying to normalize the plant names that are given to us by our suppliers.</p>
  
  <p>Each supplier can call a plant by a different name e.g. </p>
  
  <p><strong>Signode Service</strong> on our master list could be called by suppliers</p>
  
  <pre><code>Signode Service 
  Signode - Service.
  SignodeSvc
  SignodeService
  </code></pre>
  
  <p>I'm trying to strip non-alphanumeric chars so that I can try to identify the plant using our master listing by creating a series of links that look at the first 10 char, if no match, 8 char, 6, 4...</p>
  
  <p>My basic hang-up is that I don't know how to strip the alphanumeric characters from the table. I'll be doing this operation on several columns, but I planned on creating separate queries to edit the other columns.</p>
  
  <p>Perhaps I need to do a mass update query that strips all the alphanumerics. I'm still unclear on how to write it. Here's what I started out with to take out all the spaces. It worked great, but failed when I tried to nest the replace </p>
  
  <pre><code>UPDATE BTST SET ShipToPlant = replace(ShipToPlant," ","");
  </code></pre>
  
  <p><strong>EDIT 2: Further Information taken from Comments</strong></p>
  
  <p>Every month, up to 100 new permutations of our plant names appear in our line item invoice data- this could represent thousands of invoice records. I'm trying to construct a quick and dirty way to assign a master_id of the definitive name to each plant name permutation. The best way I can see to do so is to look at the plant, address, city and state fields, but the problem with this is that these fields have various permutations as well, for example,</p>
  
  <pre><code>128 Brookview Drive
  128 Brookview Lane
  </code></pre>
  
  <p>By taking out alphanumerics and doing </p>
  
  <pre><code>LEFT(PlantName,#chars) &amp; _
  LEFT(Address,#chars) &amp; _
  LEFT(City,#chars) &amp; _
  LEFT(State,#chars) 
  </code></pre>
  
  <p>and by changing the number of characters until a match is found between the invoice data and the Master Plant Listing (both tables contain the Plant, Address, City and State fields), you can eventually find a match. Of course, when you start dwindling down the number of characters you are <code>LEFT</code>ing, the accuracy becomes compromised. I've done this in excel and had decent yield. Can anyone recommend a better solution?</p>