Quantcast

Running (not all or all or partially) SQL/DDL statements in SQL editor

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Running (not all or all or partially) SQL/DDL statements in SQL editor

Ben Stover
Assume I have various SQL statements entered in the SQL editor pane.

They are all delimited by a blank line.

When I put now the cursor onto lets say the 3rd SQL statement (out of 5) and press the "run" icon in the toolbar
then all SQL statements from cursor position downwards are executed.

How can I let Squirrel only execute ONLY the SQL statement under the current cursor position (until the next blank line) and stop
then?

How can I let Squirrel execute ALL SQL statements on pane regardless of the current curosr position?

Ben






------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running (not all or all or partially) SQL/DDL statements in SQL editor

Alexandre Peshansky
Strange - when I do this, only the statement where the cursor is is executing (but I end all my statements with semicolon as well).
When I do not use blank line to separate statements, all are executed.
--
Alexandre Peshansky, MS
Senior Bioinformatics Analyst, Research Informatics Core (RIC)
Harold & Muriel Block Institute for Clinical & Translational Research at Einstein and Montefiore
Albert Einstein College of Medicine
1300 Morris Park Ave, Bronx, NY 10461
(718) 430-2440 (Mo, Tu, Th, Fr)  (718) 920-4885 (We)


-----Original Message-----
From: Ben Stover [mailto:[hidden email]]
Sent: Monday, May 13, 2013 12:44 AM
To: Squirrel SQL Users
Subject: [Squirrel-sql-users] Running (not all or all or partially) SQL/DDL statements in SQL editor

Assume I have various SQL statements entered in the SQL editor pane.

They are all delimited by a blank line.

When I put now the cursor onto lets say the 3rd SQL statement (out of 5) and press the "run" icon in the toolbar then all SQL statements from cursor position downwards are executed.

How can I let Squirrel only execute ONLY the SQL statement under the current cursor position (until the next blank line) and stop then?

How can I let Squirrel execute ALL SQL statements on pane regardless of the current curosr position?

Ben






------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running (not all or all or partially) SQL/DDL statements in SQL editor

John Hardin
In reply to this post by Ben Stover
On Mon, 13 May 2013, Ben Stover wrote:

> Assume I have various SQL statements entered in the SQL editor pane.
>
> They are all delimited by a blank line.
>
> When I put now the cursor onto lets say the 3rd SQL statement (out of 5)
> and press the "run" icon in the toolbar then all SQL statements from
> cursor position downwards are executed.
>
> How can I let Squirrel only execute ONLY the SQL statement under the
> current cursor position (until the next blank line) and stop then?

That is how it behaves for me with all the database platforms I use it
with. A blank line is a delimiter, and it only executes one block of SQL
as delimited by blank lines.

This can be annoying when you load an SQL script from a file and forget
this limitation, or if you accidentally hit RETURN once too often in the
middle of a query... :)

Be *VERY CAREFUL* of accidentally inserting a blank line before the WHERE
clause of an UPDATE or DELETE query... :(

Squirrel will execute the code preceding the cursor if it's on a blank
line after text (e.g. so you can type a query, hit [ENTER] reflexively,
then hit [CTRL]-[ENTER] and it will still execute the query you just
typed), but if your cursor is on a single blank line between queries, I'm
not sure what happens - I usually separate queries by two or more blank
lines to make selecting them a little easier.

I've *never* seen it execute from the cursor to the end of the file
regardless of blank lines like you describe.

I don't know why it wouldn't be behaving this way for you. What database
platform is this? Are all your options at the defaults? I suppose it's
possible one of the SQL parsing options (query delimiter, perhaps?) got
changed from the default and that's causing this behavior.

> How can I let Squirrel execute ALL SQL statements on pane regardless of
> the current curosr position?

[CTRL]-A to select all, then execute.  [CTRL]-A, [CTRL]-[RETURN]

What is selected (highlighted) is what will be executed regardless of
where the cursor is.

--
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  [hidden email]    FALaholic #11174     pgpk -a [hidden email]
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Drugs will always be around. Politicians are therefore making an
   active decision to distribute them through violent gangs. --Twitter
-----------------------------------------------------------------------
  347 days since the first successful private support mission to ISS (SpaceX)

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running (not all or all or partially) SQL/DDL statements in SQL editor

chris.topinka
In reply to this post by Ben Stover
Is this acceptable behavior? Should this be a feature request?
Loading...