473,408 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Executing a procedure from the cammand line

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
4 1940
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alex Vilner | last post by:
Hello! We have a set of individual .SQL scripts which we would like to execute against a MS SQL Server 2000. Is there any way to have ISQL utility (or any other means) to execute all of them...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
10
by: Heiko Pliefke | last post by:
Hi NG! I wrote a stored procedure which at first deletes 100.000 rows and then inserts 100.000 new rows. There is a huge difference between executing this SP in the query-analyzer (runtime...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
1
by: Pankaj Jain | last post by:
Hi Is there any cammand line tool by which i can able to change the build and revesion no of the compiled assembly Thanks Pankaj Jain
9
by: Leedrick | last post by:
Hi, In the past I have been dealing mainly with sql server, and recently been given the task of supporting software that uses db2 on as400. Simple tasks such as executing a stored procedure...
7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
4
by: vivsriaus | last post by:
I get this error: Line 1: Incorrect syntax near '.' when executing my stored procedure: ALTER PROCEDURE Test ( @Func VarChar(100) )
2
ilikesuresh
by: ilikesuresh | last post by:
Hi all, I have written athe following program to execute a procedure number of times using korn shell scripting for number in `cat $INPUT_FILE` do $SQLPLUS -S...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.