简体   繁体   English

运行SQL脚本而不在结果窗口中显示结果

[英]Run a SQL Script without displaying result in result window

I have a DB initialization script, which does several hundred inserts to the DB... every time I release, I need to run this script and I always get a notification, that I have too many result windows for this script. 我有一个数据库初始化脚本,该脚本在数据库中进行数百次插入...每次发布时,我都需要运行此脚本,并且总是收到一条通知,通知我该脚本的结果窗口过多。 This is how the script looks like: 脚本如下所示:

My SQL script contains a mix of select and insert statements like this: 我的SQL脚本包含以下选择和插入语句的组合:

-- I don't want these select statements to produce any result in the result window
SELECT @var1 := col1 FROM table1 WHERE col1 = 'some value';
SELECT @var2 := col2 FROM table2 WHERE col2 = 'some other value';

INSERT INTO table3(col1) VALUES(@var1);
INSERT INTO table4(col1) VALUES(@var2);

Is there any SQL command that I could include on top of this long script, which tells MySQL Workbench (V 6.3) that I am not interested in seeing the result for this particular script? 我可以在此长脚本之上包含任何SQL命令 ,该命令告诉MySQL Workbench(V 6.3)我不希望看到该特定脚本的结果吗?

The Output is located at the bottom of MySQL Workbench. 输出位于MySQL Workbench的底部。 Its select box includes the Action Output, History Output, and Text Output options. 它的选择框包括“动作输出”,“历史记录输出”和“文本输出”选项。

The Action Output panel displays a summary of the communication between the active MySQL connection in MySQL Workbench and the MySQL server, and can refer to errors or general information. “动作输出”面板显示MySQL Workbench中活动的MySQL连接与MySQL服务器之间的通信摘要,并且可以引用错误或常规信息。

The History Output panel provides a history of SQL operations carried out in MySQL Workbench for the active MySQL connection. “历史记录输出”面板提供了在MySQL Workbench中为活动MySQL连接执行的SQL操作的历史记录。 The time and SQL code for each operation is recorded. 记录每个操作的时间和SQL代码。

Switch from "Action Output" to "History Output" 从“动作输出”切换到“历史输出”

https://dev.mysql.com/doc/workbench/en/wb-develop-sql-editor-history.html https://dev.mysql.com/doc/workbench/en/wb-develop-sql-editor-history.html

Thanks to the comment by @MikeLischke, I used Do command to execute the select statements, without producing any result in the result window: 感谢@MikeLischke的评论,我使用Do命令来执行select语句,而不会在结果窗口中产生任何结果:

DO (SELECT @var1 := col1 FROM table1 WHERE col1 = 'some value');
DO (SELECT @var2 := col2 FROM table2 WHERE col2 = 'some other value');

INSERT INTO table3(col1) VALUES(@var1);
INSERT INTO table4(col1) VALUES(@var2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM