在 MS Access 中删除单元格内的字符串 [英] Remove a string inside a cell in MS Access

查看:55
本文介绍了在 MS Access 中删除单元格内的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除 MS Access 中某个单元格中的某个字符串,无论是在列中还是在整个表中.我知道我可以使用普通的 Find and Replace 来做到这一点,但在这种情况下,我的千行表并不经济.

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.

例如,

  • 从所有列中删除所有 Unknown 值.
  • price 列中的值中删除字符串dollars",即.如果单元格包含34 美元",则它只会是34".
  • 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".

这可以在 SQL 中完成吗?如何完成?

Can this be done in SQL and how?

推荐答案

假设您的查询将在 Access 会话中运行,第二个目标很容易.你可以用一个零长度的字符串Replace dollars.

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', '');

您可以对第一个目标使用相同的策略,但可能会认为检查表字段的数据类型和仅 UPDATE 文本或备忘录的数据类型更有意义.

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.

这篇关于在 MS Access 中删除单元格内的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆