即使在MySQL工作台中发生错误也继续执行SQL查询 [英] Continue SQL query even on errors in MySQL workbench
问题描述
我正在使用MySQL工作台将Joomla sample_data.sql文件导入我的本地数据库.我希望它通过跳过导致错误的行来继续导入,即使发生错误也是如此.
I'm using MySQL workbench to import a Joomla sample_data.sql file into my local database. I want it to continue importing, even if an error occurs, by skipping the line that caused the error.
是否可以在SQL前面加上一些前缀,以防止查询因任何错误而中止?
Is there something I can prefix the SQL with to prevent the query from halting at any errors?
推荐答案
在MySQL Workbench中,我取消了查询中的选项"中的在错误时停止脚本执行":
In MySQL Workbench, I unticked the option under Query to "Stop Script Execution on Errors":
看起来津巴布韦的答案也能奏效.
It looks like Zimbabao's answer will work also.
在较新的版本中,使用切换是否在失败的语句后继续执行SQL脚本"
In newer versions use 'Toggle whether execution of SQL script should continue after failed statements'
这篇关于即使在MySQL工作台中发生错误也继续执行SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!