By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,041 Members | 1,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,041 IT Pros & Developers. It's quick & easy.

Executing a procedure from the cammand line

P: n/a
I have a SQL command procedure, myproc.sql, containing sql statements. After
I login to MySQL, how do I execute this procedure?

mysql> ?????? what goes here???

Thanks...

Bruce
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
mysql -u USERNAME -p < myproc.sql

sanjay
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
| I have a SQL command procedure, myproc.sql, containing sql statements.
After
| I login to MySQL, how do I execute this procedure?
|
| mysql> ?????? what goes here???
|
| Thanks...
|
| Bruce
|
|
Jul 17 '05 #2

P: n/a
Is

mysql -u USERNAME -p < myproc.sql

the only way.

If so, then if I have two procs to execute, I would execute one of them,
then I would have to "quit" and login a second time.

I was trying to avoid this.. I was hoping I could:

Login...

C:>mysql -u abc -p

Execute the two procs from the command line

mysql>Something MyProc1.sql;
mysql>Something MyProc2.sql;

Thanks....

Bruce
"s a n j a y" <so*****@somewhere.com> wrote in message
news:uj*******************@newssrv26.news.prodigy. com...

sanjay
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
| I have a SQL command procedure, myproc.sql, containing sql statements.
After
| I login to MySQL, how do I execute this procedure?
|
| mysql> ?????? what goes here???
|
| Thanks...
|
| Bruce
|
|

Jul 17 '05 #3

P: n/a
I dont know how to do it after you go to mysql shell. But you dont relly
need to do that way. If multiple files is your problem, then you have two
options,

1. concatenate files manually and run as a single sql. or

2. do something like -
cat sql1.sql sql2.sql | mysql -u USERNAME -p

haven't tested second one, but should work.

sanjay


"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
| Is
|
| mysql -u USERNAME -p < myproc.sql
|
| the only way.
|
| If so, then if I have two procs to execute, I would execute one of them,
| then I would have to "quit" and login a second time.
|
| I was trying to avoid this.. I was hoping I could:
|
| Login...
|
| C:>mysql -u abc -p
|
| Execute the two procs from the command line
|
| mysql>Something MyProc1.sql;
| mysql>Something MyProc2.sql;
|
| Thanks....
|
| Bruce
|
|
| "s a n j a y" <so*****@somewhere.com> wrote in message
| news:uj*******************@newssrv26.news.prodigy. com...
| > >
| > sanjay
| >
| >
| > "Bruce A. Julseth" <br*****@attglobal.net> wrote in message
| > news:3f********@news1.prserv.net...
| > | I have a SQL command procedure, myproc.sql, containing sql statements.
| > After
| > | I login to MySQL, how do I execute this procedure?
| > |
| > | mysql> ?????? what goes here???
| > |
| > | Thanks...
| > |
| > | Bruce
| > |
| > |
| >
| >
|
|
Jul 17 '05 #4

P: n/a
Thank you..

Bruce

"s a n j a y" <so*****@somewhere.com> wrote in message
news:hO*******************@newssrv26.news.prodigy. com...
I dont know how to do it after you go to mysql shell. But you dont relly
need to do that way. If multiple files is your problem, then you have two
options,

1. concatenate files manually and run as a single sql. or

2. do something like -
cat sql1.sql sql2.sql | mysql -u USERNAME -p

haven't tested second one, but should work.

sanjay


"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
| Is
|
| mysql -u USERNAME -p < myproc.sql
|
| the only way.
|
| If so, then if I have two procs to execute, I would execute one of them,
| then I would have to "quit" and login a second time.
|
| I was trying to avoid this.. I was hoping I could:
|
| Login...
|
| C:>mysql -u abc -p
|
| Execute the two procs from the command line
|
| mysql>Something MyProc1.sql;
| mysql>Something MyProc2.sql;
|
| Thanks....
|
| Bruce
|
|
| "s a n j a y" <so*****@somewhere.com> wrote in message
| news:uj*******************@newssrv26.news.prodigy. com...
| > >
| > sanjay
| >
| >
| > "Bruce A. Julseth" <br*****@attglobal.net> wrote in message
| > news:3f********@news1.prserv.net...
| > | I have a SQL command procedure, myproc.sql, containing sql statements. | > After
| > | I login to MySQL, how do I execute this procedure?
| > |
| > | mysql> ?????? what goes here???
| > |
| > | Thanks...
| > |
| > | Bruce
| > |
| > |
| >
| >
|
|

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.