【发布时间】:2013-06-18 17:39:27
【问题描述】:
我希望替换我的数据库中所有表的所有列中出现的所有字符。
我的专栏名称是这样的:
从information_schema.columns中选择表名、列名;
我会像这样应用更新替换:
update table_name set column_name = replace (column_name, "a", "A");
PS : 将“a”替换为“A”只是一个例子,我的问题是如何在我的两个查询之间链接 table_name 和 column_name。
我尝试了子选择,例如:
update (select table_name from information_schema.tables as tables) set (select column_name from columns as information_schema.columns where table_name = tables) = replace (columns, "a", "A");
但我在尝试时仍然会出错。这样做的正确方法是什么?
提前谢谢你。
【问题讨论】: