tags:

views:

842

answers:

4

I already used Microsoft SQL Server 2005 and found really easy to execute single/multiple lines of an sql query.

Example:

insert into tablea
($vala, $valb, $valc)
values
($vala, $valb, $valc);


insert into tableb
($vala, $valb, $valc)
values
($vala, $valb, $valc);

How can I execute the second part only? In MSSQL i will highlight the second insert statment and press F5. How can do this in mySQL?

A: 

Does selecting the second part and "EXECUTE" help? If not, then I am not sure if such a use case is supported. You might want to try MySQL Workbench though.

Amit
You need to use mysql workbench commercial version to connect remotlely to database servers?
David Bonnici
You can use an SSH tunnel to securely connect to a MySQL remote server. Here's an example using PuTTY on windows: http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html
pygorex1
+1  A: 

You can do this. When you have logged into MySQL query browser, and you write two complete statments such as:

select "hello world";
select "second query";

You will notice two blue dots on the left side of the window they are left of the line numbers. By default it will try to exec the first command. That might be why you see one command with white background and all the others with a grey background. The command that is white, is highlighted and it is the one that will be executed. You should be able to just click anywhere inside the second query to highlight it and then click the lightning bolt button (execute) to run it.

DJTripleThreat
A: 

well the issue here is that if i write the queries :

select "hello world"; select "second query";

and Execute it gives error -- when i select/highlight any one of them and execute it gives the same error -- so i have to either delete one of the queries or comment it out or use the script editor which doesn't work for me and lot of other users who have use MS SQL 2000,2005.

If there a solution for this -- ideally it should execute the query i select . Just an opinion

Rohan

rgolwalkar
+1  A: 

The problem is that you must be trying to execute your query from a Query Tab rather than from a Script Tab. Go to File -> New Script Tab and input your multiple statements there. Next click the execute button... that's it.

Hope it helps!

Machi

Machi