0

MySQL Workbench 的 EER 建模模式中有一个工具可以编写与模型一起存储的 SQL 脚本。但是我到处看了看,除了将其复制并粘贴到查询模式的窗口中之外,看不到任何执行此类脚本的方法。有一个菜单项 Scripting/Run Script,但它似乎并没有真正做任何事情。除了存储 SQL 文本之外,模型的脚本部分肯定还有一些应用吗?

4

1 回答 1

0

Running arbitrary SQL code during forward engineering or synchronization is not possible. The only code that gets executed is the sql to create the objects and to fill tables with data specified in the Inserts section of the table editor.

Running an sql script in general is of course possible and also trivial. Simply open a connection to your server (you should have one created on the home screen, if not do this first). Then in the editor toolbar there's a button to open a script. Use that to open the file (if you have a separate sql file). If you want to run code that is stored in the model (as SQL file) you have to copy/paste it over.

于 2014-03-04T07:37:08.387 回答