This is a discussion on batch mode separator within the MySQL Database forums, part of the Database Forums category; Hi, I know this has been asked many times before, but i havent seen it answered anywhere. i got software ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I know this has been asked many times before, but i havent seen it answered anywhere. i got software that generates sql scripts. in sql server, you separate parts of the script with the GO keyword, which is not really part of SQL and not supported here. how do i separate between statements in mysql then? without proper separation the batch will not run (i am simply pasting it to sqlyog and running it0 thanks!! |
|
|||
|
On Sun, 6 Jul 2008 10:58:53 -0700 (PDT), Jonathan Sion
<yoni@nobhillsoft.com> wrote: >Hi, >I know this has been asked many times before, but i havent seen it >answered anywhere. i got software that generates sql scripts. in sql >server, you separate parts of the script with the GO keyword, which is >not really part of SQL and not supported here. how do i separate >between statements in mysql then? without proper separation the batch >will not run (i am simply pasting it to sqlyog and running it0 > >thanks!! GO (usually on a line on its own) is the same as ending the last line of an SQL statement with a semicolon; HTH -- ( Kees ) c[_] Natives who beat drums to drive off evil spirits are objects of scorn to smart Americans who blow horns to break up traffic jams. (Mary Ellen Kelly) (#470) |
|
|||
|
Jonathan Sion wrote:
> Hi, > I know this has been asked many times before, but i havent seen it > answered anywhere. i got software that generates sql scripts. in sql > server, you separate parts of the script with the GO keyword, which is > not really part of SQL and not supported here. how do i separate > between statements in mysql then? without proper separation the batch > will not run (i am simply pasting it to sqlyog and running it0 > > thanks!! Short question, long answer. It depends on how you use your multi-statement script. Some ways of passing SQL do not support multiple statements to be passed in one string at all. Some do, but MySQL does not have the same notion of a batch as SQL server. It does not really matter if you pass it in single statements or in one batch. Specifically, all states and variables are kept in a "connection" instead of a batch. So as long as you use the same connection, you can query results, generated IDs etc. You can also use this to separate things: You can do error logging (if you log to a database) in a separate connection to prevent rollbacks rolling back the error info as well. For libraries that do support batches, you separate all the statements with semicolons. Best regatds, -- Willem Bogaerts Application smith Kratz B.V. http://www.kratz.nl/ |