Remove a string inside a cell in MS Access

ぃ、小莉子 提交于 2021-01-28 07:12:22

问题


I want to delete a certain string in a cell in MS Access, whether in a column or in the whole table. I know that I can do this using plain old Find and Replace but in this case it is not economical for my thousand-row table.

For example,

  • remove all Unknown values from all columns.
  • remove the string "dollars" from the values in column price ie. if the cell contains "34 dollars", it will just be "34".

Can this be done in SQL and how?


回答1:


Assuming your query will run within an Access session, the second goal is easy. You can Replace dollars with a zero-length string.

UPDATE YourTable
SET price = Replace(price, 'dollars', '');

You could use the same strategy for the first goal, but may decide it makes more sense to examine the datatypes of the table's fields and only UPDATE those which are text or memo.



来源:https://stackoverflow.com/questions/21118011/remove-a-string-inside-a-cell-in-ms-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!