removing characters from field in MS Access database table

后端 未结 4 999
不知归路
不知归路 2021-01-18 21:27

Using MS Access 2010. I have a field in a table that contains windows path names surrounded by quotes, like this

\"C:\\My Documents\\Photos\\img1.jpg\"
\"C:\         


        
4条回答
  •  孤街浪徒
    2021-01-18 21:59

    The solution with REPLACE already mentioned by others works, but removes ALL quotes, even if they are in the middle of the string.

    If you only want to remove quotes at the beginning or at the end, but leave quotes in the middle of the string as they are, you can do it with the following two queries:

    Remove first character if it's a quote:

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

    Remove last character if it's a quote:

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

提交回复
热议问题