Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Problem Running Multiple Sql Statements In The Query Window

forums forums SQLyog Using SQLyog Problem Running Multiple Sql Statements In The Query Window

  • This topic is empty.
Viewing 6 reply threads
  • Author
    Posts
    • #12965
      jjscott
      Member

      I’m trying to execute multiple SQL statements in the SQLYog query windows and found that only the first statement executes. As a test, I tried the following statements and selected the “Execute All Queries” button. What I found is that SQLYog only executed the first statement. I also tried highlighting both statements and selecting the “Execute All Queries” button, but got the same thing. I can run both from the MySQL command line with no problem.

      On the surface, I found that I can run multiple statements such as Inserts, Updates, Sets, but I can't run multiple select statements. If I add a select at the top of three consecutive insert statements, the sql dies after executing the select.

      Can someone share with me what I’m doing wrong?

      SELECT NOW() AS test1;

      SELECT NOW() AS test2;

    • #34273
      sathish
      Member

      If the query has multiple SELECT statements you can see multiple result tabs at the bottom. Please find the screenshot attached.

    • #34274
      jjscott
      Member

      I don't think you understand what I'm trying to do. I'm not trying to execute one sql statement at a time. I'm trying to execute multiple statements in a script. It would appear that you ran each statement individually and took screenshots after each statement was run. Try using the “Execute All Queries” for the following script. I bet it doesn't proceed past the “SELECT SLEEP(@TimeInterval);” statement.

      In order to get the desired result provided by the end of the script, I had to highlight everything after the “SELECT SLEEP(@TimeInterval);” statement and run “Execute All Queries”. I had to do this after the script terminated at the “SELECT SLEEP(@TimeInterval);”. As mentioned in my original post, I don't have to do this if I run the same script from the MySQL command line. Is this normal behavior for SQLYog?

      SET @TimeInterval = 10;

      SELECT variable_value INTO @num1 FROM information_schema.global_status

      WHERE variable_name = 'Innodb_os_log_written';

      SELECT SLEEP(@TimeInterval);

      SELECT variable_value INTO @num2 FROM information_schema.global_status

      WHERE variable_name = 'Innodb_os_log_written';

      SET @ByteWrittenToLog = @num2 – @num1;

      SET @KB_WL_HR = @ByteWrittenToLog / POWER(1024,1) * 3600 / @TimeInterval;

      SET @MB_WL_HR = @ByteWrittenToLog / POWER(1024,2) * 3600 / @TimeInterval;

      SET @GB_WL_HR = @ByteWrittenToLog / POWER(1024,3) * 3600 / @TimeInterval;

      SELECT @KB_WL_HR,@MB_WL_HR,@GB_WL_HR;

    • #34275
      Jan.S
      Member

      I don't think you have looked at our screen shots carefully. In your first screenshot, there are 2 result tabs. Could you click on the second one? It should have the result of your second statement.

      Please take a look at the attached screenshot.

    • #34276
      jjscott
      Member

      Wow. I totally missed that. Apologies for the confusion and thanks for setting me straight!

    • #34277
      Rahul_Rohan
      Member

      Hii. I am executing Multiple Select statements in SQL YOG and it throws error :-

      Query: SELECT msisdn FROM tbl_users_profile WHERE nick_name like '00000645064A062A06480000' SELECT msisdn FROM tbl_users_profile WHERE …

      Error Code: 1064

      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT msisdn FROM tbl_users_profile WHERE nick_name like '000106270644062706450' at line 2

      Execution Time : 0 sec

      Transfer Time : 0 sec

      Total Time : 0.069 sec


      Please help me I am trying this :-

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '00000645064A062A06480000'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '00010627064406270645064A063106680668'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '000A000A0633064A062F06310627'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '0633062A0627062606310661'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '064506480645064A0627062106270644062D0628'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '003f003f003f003f002e003f003f003f003f002e'

      SELECT msisdn FROM tbl_users_profile WHERE nick_name LIKE '003f003f003f003f005f003f003f003f003f003f'

    • #34278
      sathish
      Member

      @Rahul_Rohan

      Could you please try adding a semicolon at end of each statement and try executing again.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.