views:

69

answers:

3

i am a little confused in finding out what would be the best way to replace all occurances of 1. Blanks 2. - 3. NA from all collumns of TableA with question mark ? charachter.

Sample Row in orignal tableA

444586  RAUR <blank> 8 570 NA - 13 - SCHS299 MP 339 70 EN <blank>

Same Row in Expected TableA

444586  RAUR ? 8 570 ? ? 13 ? SCHS299 MP 339 70 EN ?

please help me out

I cant use the Find Replace Toolbar of access.

A: 
UPDATE tableA
SET myColumn = "?"
WHERE TRIM(myColumn) = "" OR TRIM(myColumn) = "-" OR TRIM(myColumn) = "NA"

Note: Take the backup of the table, before executing this statement.

shahkalpesh
I suspect that that doesn't answer the question specifically: "from all collumns". To do an update on a named column is easy, the logic to identify the column names and create queries based upon that is a bit more interesting.
Murph
+1  A: 

You can try something like this for all columns you require

UPDATE Table1 SET 
Table1.Col1 = IIf(Trim([COL1]) In ("","-","NA"),"?",[Col1]), 
Table1.Col2 = IIf(Trim([COL2]) In ("","-","NA"),"?",[Col2]), 
Table1.Col3 = IIf(Trim([COL3]) In ("","-","NA"),"?",[Col3]), 
Table1.Col4 = IIf(Trim([COL4]) In ("","-","NA"),"?",[Col4]), 
Table1.Col5 = IIf(Trim([COL5]) In ("","-","NA"),"?",[Col5]);
astander
cool... you're a genius :)
silverkid
A: 

Here's hoping you may draw inspiration from this article:

How To Handle Missing Information Without Using (some magic value)

onedaywhen