Is it possible to run nested scripts in MySQL?

If I want to run a script called TestA1.sql where TestA1.sql contains:

select * from Sample.emp;

all I need to do is go to the MySQL command prompt and enter:

\. TestA1.sql

That's a single, un-nested script and it works fine.

Now, suppose I have a script named TestA.sql which in turn wants to invoke TestA1.sql and TestA2.sql. I've already shown you TestA1.sql; here's TestA2.sql:

select * from Sample.dept;

How do I construct TestA.sql so that it invokes TestA1.sql and TestA2.sql? I want to invoke TestA.sql from the MySQL command prompt with this:

\. TestA.sql

and have it execute both TestA1.sql and TestA2.sql.

I've tried a few different ways of constructing TestA.sql but none of them works; I'm not sure if that's because it simply isn't possible to nest scripts in MySQL or if I simply haven't guessed the right syntax yet. I've tried a variety of versions of TestA.sql, like the following, without success:

--1
TestA1.sql
TestA2.sql

--2
. TestA1.sql
. TestA2.sql


Is it possible to run a construct an outer script that invokes other scripts and then run the outer script from the MySQL command prompt? If yes, how would the outer script look?

I could guess all morning and maybe I'd hit the magic syntax eventually but I'd rather not waste the time if what I'm trying to do is impossible. I can't find anything on this issue in the manual or in the archives.

I am running MySQL 4.0.15.

---
Rhino



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.18/230 - Release Date: 14/01/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to