![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.lists (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. |
#4
| |||
| |||
|
|
DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.li... (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. |
#5
| |||
| |||
|
|
Dinesh, or are you thinking of a way to check for syntax errors without executing the queries? Then dbisql -x should do. HTH Volker "Paul Horan[TeamSybase]" <phoran AT sybase DOT com> wrote innews:4725f91d (AT) forums-1-dub (DOT) .. DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.li... (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. |
#6
| |||
| |||
|
|
On Oct 29, 8:38 pm, "Volker Barth" <No_VBarth (AT) Spam_GLOBAL-FINANZ (DOT) de wrote: Dinesh, or are you thinking of a way to check for syntax errors without executing the queries? Then dbisql -x should do. HTH Volker "Paul Horan[TeamSybase]" <phoran AT sybase DOT com> wrote innews:4725f91d (AT) forums-1-dub (DOT) .. DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.li... (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. I'll paint a bigger picture. My application needs to upgrade the DB to sync it with the app version. We have currently say 10 sql files that push the DB schema from version 1 to version 2. What we currently are doing is to run dbisql on each of those 10 files to upgrade. But in case we face an issue during say the 5th file, we would have committed till the 4th and hence negate a rollback. I'm considering the following options:- 1. Concatenate the files into 1 and then execute dbisql on that one file. The files are different for logical separations only. Also, does DBISQL auto-commit on a DDL statement? 2. Parse those 10 files and then execute the parsed SQL over a jdbc connection to the DB during which I can control commits. Thoughts? - Dinesh. |
#7
| |||
| |||
|
|
On Oct 29, 7:15 pm, "Paul Horan[TeamSybase]" <phoran AT sybase DOT com> wrote: DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.li... (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. What I actually needed was a way to parse the SQL so that I can control the transaction. Its not 1 file I'm talking about, its multiples of them. Is there any way to do it or is dbisql the only option. I was thinking one way could be to concatenate the files into one and then feed them to dbisql. - Dinesh. |
#8
| |||
| |||
|
|
On Oct 29, 8:38 pm, "Volker Barth" <No_VBarth (AT) Spam_GLOBAL-FINANZ (DOT) de wrote: Dinesh, or are you thinking of a way to check for syntax errors without executing the queries? Then dbisql -x should do. HTH Volker "Paul Horan[TeamSybase]" <phoran AT sybase DOT com> wrote innews:4725f91d (AT) forums-1-dub (DOT) .. DBISQL will run the statements in the order they appear in the file. If you want to alter the flow of the batch, you can use conditional logic (IF/THEN/ELSE statements). Am I not understanding your requirements?? Paul Horan[TeamSybase] dpillay.li... (AT) gmail (DOT) com> wrote in message news:1193668524.550137.170140 (AT) q3g2000prf (DOT) googlegroups.com... All, Given the situation that I have an SQL file with multiple queries, does Sybase provide a way to parse that file and execute each of the queries in turn? The individual queries themselves are mutually exclusive from the rest but being able to parse properly (say how to parse a "create procedure" statement) is the actual problem. - Dinesh. I'll paint a bigger picture. My application needs to upgrade the DB to sync it with the app version. We have currently say 10 sql files that push the DB schema from version 1 to version 2. What we currently are doing is to run dbisql on each of those 10 files to upgrade. But in case we face an issue during say the 5th file, we would have committed till the 4th and hence negate a rollback. I'm considering the following options:- 1. Concatenate the files into 1 and then execute dbisql on that one file. The files are different for logical separations only. Also, does DBISQL auto-commit on a DDL statement? 2. Parse those 10 files and then execute the parsed SQL over a jdbc connection to the DB during which I can control commits. Thoughts? - Dinesh. |
![]() |
| Thread Tools | |
| Display Modes | |
| |