Removing characters from a field in a MS Access database table

Using MS Access 2010. I have a field in a table containing Windows path names surrounded by quotation marks, for example

"C:\My Documents\Photos\img1.jpg"
"C:\My Documents\Photos\products\gizmo.jpg"
"C:\My Documents\Photos\img5.jpg"

etc.

I need to get rid of the quotes so that the column looks like this:

C:\My Documents\Photos\img1.jpg
C:\My Documents\Photos\products\gizmo.jpg
C:\My Documents\Photos\img5.jpg

Is there a way to write an update request to do this? OR is the best way to do this at all?

+3
source share
4 answers

If you will do this from an access session using Access 2000 or newer, you can use the function Replace()in the update request to remove quotes. To delete would be to replace them with an empty string.

UPDATE YourTable
SET path_field = Replace(path_field, '"', '');

- (yuck!), Mid()... ( ) Len(path_field) - 2

UPDATE YourTable
SET path_field = Mid(path_field, 2, Len(path_field) - 2);

, WHERE, path_field.

WHERE Len(path_field) > 0

, WHERE, , , path_field .

WHERE path_field Like '"*"'

* wild card for Access ANSI 89. ADO ( ANSI 92), % wild.

WHERE path_field Like '"%"'

... ALike % wild card .

WHERE path_field ALike '"%"'
+6

REPLACE, , , , .

, , , :

, :

update YourTable
set YourField = right(YourField, len(YourField) - 1)
where left(YourField, 1) = '"'

, :

update YourTable
set YourTable = left(YourField, len(YourField) - 1)
where right(YourField, 1) = '"'
+1

, , :

UPDATE [Your Table]
SET [Your Table].[Your Field] = Replace([Your Table].[Your Field],"""","")

, . , , .

0

, - MyColumn, - MyTable, sql , .

UPDATE MyTable
SET MyColumn = REPLACE(MyColumn,'"','')
0

All Articles