> Is there really a SOURCE command? Where is it in the official manual?

"source" is a command available within the mysql client only. It is not a SQL command.
The client can also get external "batch" files by piping the commands, in Unix style.
Once you have your file of SQL instructions (say "lines.sql") you can call the client 
$ mysql -u username -p < lines.sql


> ------------------------
> mysql> set @var = "xyz";
> mysql> SOURCE filename
> ------------------------ 
> can @var be used in filename?

Yes, it can.
Variables are valid within the same thread.

$ echo "select @var;" > hhh.sql
$ mysql -p -u xyz

mysql> select @var:=curdate();
+-----------------+
| @var:=curdate() |
+-----------------+
| 2001-11-20      |
+-----------------+
1 row in set (0.00 sec)

mysql> source hhh.sql
+------------+
| @var       |
+------------+
| 2001-11-20 |
+------------+
1 row in set (0.00 sec)

mysql> select @var:="AAA";
+-------------+
| @var:="AAA" |
+-------------+
| AAA         |
+-------------+
1 row in set (0.00 sec)

mysql> source hhh.sql
+------+
| @var |
+------+
| AAA  |
+------+
1 row in set (0.00 sec)

Bye
Giuseppe





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to