RE: HOW TO RUN SQL

2004-02-09 Thread Remko Lodder
if you want to do sql scripting
then i suggest you use  a  bash script with the settings i provided to you

oh If you are able to, please don't use HTML mail thanks
cheers



--

Kind regards,

Remko Lodder
Elvandar.org/DSINet.org
www.mostly-harmless.nl Dutch community for helping newcomers on the
hackerscene

mrtg.grunn.org Dutch mirror of MRTG
-Oorspronkelijk bericht-
Van: Seena Blace [mailto:[EMAIL PROTECTED]
Verzonden: maandag 9 februari 2004 23:11
Aan: Remko Lodder; [EMAIL PROTECTED]
Onderwerp: HOW TO RUN SQL


how to run sql script like
if i have mysql prompt
mysql 
at above prompt I want to run sql script. how to do this? what will be
extenstion of file?

Remko Lodder [EMAIL PROTECTED] wrote:
mysql -p -u -e

that can be runned from any shell script.

use enum to check Y/N TRUE/FALSE etc.

CREATE TABLE testtest (
test ENUM( 'TRUE', 'FALSE' ) NOT NULL
);


it automaticly sets true as default value with me.
otherwise add:

DEFAULT 'FALSE'

after not null

Hope this helps
--

Kind regards,

Remko Lodder
Elvandar.org/DSINet.org
www.mostly-harmless.nl Dutch community for helping newcomers on the
hackerscene
mrtg.grunn.org Dutch mirror of MRTG

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Seena Blace
Verzonden: maandag 9 februari 2004 22:14
Aan: [EMAIL PROTECTED]
Onderwerp: [Mysql-discussions] HOW TO RUN SQL and def ault value ?


Hi,
How to run script at mysql prompt?
Like if i want to create a table or select some query and I want to put
those sql statement into one file ,how to run that and what would be the
extention of that query?
I want to create on column which contains only default value TRUE or
False.how to do that?
Create table test1 (no int, flag char (6) default ...
thx -seena



-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


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



Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


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



Re: HOW TO RUN SQL

2004-02-09 Thread KKoTY
hi, to run a sql script from mysql shell just use command source
your_sql_script.sql
if you want to run it directly from prompt use this

mysql --force -uusername -ppassword -esource your_sql_script.sql



- Original Message -
From: Seena Blace [EMAIL PROTECTED]
To: Remko Lodder [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 09, 2004 11:10 PM
Subject: HOW TO RUN SQL


 how to run sql script like
 if i have mysql prompt
 mysql 
 at above prompt I want to run sql script. how to do this? what will be
extenstion of file?

 Remko Lodder [EMAIL PROTECTED] wrote:
 mysql -p
  -u -e

 that can be runned from any shell script.

 use enum to check Y/N TRUE/FALSE etc.

 CREATE TABLE testtest (
 test ENUM( 'TRUE', 'FALSE' ) NOT NULL
 );


 it automaticly sets true as default value with me.
 otherwise add:

 DEFAULT 'FALSE'

 after not null

 Hope this helps
 --

 Kind regards,

 Remko Lodder
 Elvandar.org/DSINet.org
 www.mostly-harmless.nl Dutch community for helping newcomers on the
 hackerscene
 mrtg.grunn.org Dutch mirror of MRTG

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Seena Blace
 Verzonden: maandag 9 februari 2004 22:14
 Aan: [EMAIL PROTECTED]
 Onderwerp: [Mysql-discussions] HOW TO RUN SQL and default value ?


 Hi,
 How to run script at mysql prompt?
 Like if i want to create a table or select some query and I want to put
 those sql statement into one file ,how to run that and what would be the
 extention of that query?
 I want to create on column which contains only default value TRUE or
 False.how to do that?
 Create table test1 (no int, flag char (6) default ...
 thx -seena



 -
 Do you Yahoo!?
 Yahoo! Finance: Get your refund fast by filing online


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


 -
 Do you Yahoo!?
 Yahoo! Finance: Get your refund fast by filing online


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



Re: How to Run SQL Commands from a Text File stably?

2001-11-12 Thread Denis Hammond

Giuseppe Maxia wrote:

 12/11/2001 05:32:28, PI Xu [EMAIL PROTECTED] wrote:

 Hi, Buddies:
 
 I used perl to run sql commands from a Text file, it always can't finish
 totally and report error in unstable lines .
 The error report that sql syntax error, but the syntax is same, just same,
 and many sql lines;
 Would you please tell me what this happen and how to resolve it?
 
 Thanks in Advance!
 Bill
 
 PERL COMMANDS: system('mysql -uusername -ppassword database 
 pricfile.sql');
 
 if pricfile.sql has 37871 lines sql commands like
 update products set retail=43.00 where partno='123456';
 then the perl program give
 ERROR 1064 at line 37850: You have an error in your SQL syntax near
 ''99922' at line 1
 

 I think you should have a look at the lines 37849 and 37850.
 The error could be that the previous one was wrongly terminated,
 or the current one has an invalid value.
 It could be a problem of unproper quoting.
 Having a look at the lines involved could be helpful. How did you produce the file?

 Bye
 Giuseppe

 
 if pricfile.sql has 1 lines, then the perl program give
 ERROR 1064 at line 19932: You have an error in your SQL syntax near '' at
 line 1
 
 if pricfile.sql has 17872 lines sql commands like, then the perl program
 give
 ERROR 1064 at line 17848: You have an error in your SQL syntax near '' at
 line
 
 
 -
 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
 
 
 

 -
 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

One potential error is the lack of quoting in: retail=43.00  where...
Try using: retail='43.00' where...


Also, it would make things easier if you would give the exact error message, with the
line where the error occurred.

Denis


-
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




RE: How to Run SQL Commands from a Text File stably?

2001-11-12 Thread Daniel J McDonald

I used perl to run sql commands from a Text file, it always can't finish
totally and report error in unstable lines .
The error report that sql syntax error, but the syntax is same, just same,
and many sql lines;
Would you please tell me what this happen and how to resolve it?

What you ought to do is use perl to parse the file and run the commands
individually.

use DBI;
my $driver=mysql;
my $database=database;
my $user=username;
my $password=password;
my $dns = DBI:$driver:database=$database;
my $db=DBI-connect($dns, $user, $password);

open SQL, $ARGV[0];
open ERRORS, errors.sql;

while (my $line = SQL) {
$line =~ s/;$// ;
$db-do($line);
if $db-err {
write ERRORS, $line . ;\n;
}
}
$db-disconnect;
close SQL;
close ERRORS;

That would execute all of the statements that were legal, and put any
errored statements in a separate file for you to clean up at your leisure.

More elaborate parsing would be required if the statements were multi-line.

Daniel J McDonald, CCIE 2495, CNX
Principal Network Specialist
Digicon Technologies
http://www.digicontech.com

Digicon, a Cisco Partner, Silver Certified.


-
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




Re: How to Run SQL Commands from a Text File stably?

2001-11-11 Thread Giuseppe Maxia

12/11/2001 05:32:28, PI Xu [EMAIL PROTECTED] wrote:

Hi, Buddies:

I used perl to run sql commands from a Text file, it always can't finish
totally and report error in unstable lines .
The error report that sql syntax error, but the syntax is same, just same,
and many sql lines;
Would you please tell me what this happen and how to resolve it?

Thanks in Advance!
Bill

PERL COMMANDS: system('mysql -uusername -ppassword database 
pricfile.sql');

if pricfile.sql has 37871 lines sql commands like
update products set retail=43.00 where partno='123456';
then the perl program give
ERROR 1064 at line 37850: You have an error in your SQL syntax near
''99922' at line 1



I think you should have a look at the lines 37849 and 37850.
The error could be that the previous one was wrongly terminated, 
or the current one has an invalid value. 
It could be a problem of unproper quoting.
Having a look at the lines involved could be helpful. How did you produce the file?

Bye
Giuseppe




if pricfile.sql has 1 lines, then the perl program give
ERROR 1064 at line 19932: You have an error in your SQL syntax near '' at
line 1

if pricfile.sql has 17872 lines sql commands like, then the perl program
give
ERROR 1064 at line 17848: You have an error in your SQL syntax near '' at
line


-
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







-
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




RE: how to run sql script in NT

2001-10-26 Thread Andrew Murphy

Hi,

Try typing:
  mysql  Temp.sql
while at the DOS prompt.


Andrew


-Original Message-
From: Barbara Ferrell [mailto:[EMAIL PROTECTED]]
Sent: 26 October 2001 2:15 pm
To: [EMAIL PROTECTED]
Cc: barbara
Subject: how to run sql script in NT


i am extremely new at this:

i am on  NT4.0

i am in a DOS screen at the mysql prompt (mysql)
the path that is described in the top of the window is: =3D
c:\apache\mysql\bin\mysql.exe


i wrote a script to create and load a database exactly as it said in the =
=3D
book..  i saved the file as ..Temp.sql

then i typed:
mysql temp.sql ;  at the mysql prompt

it doesn't recognize the .sql file... how do I get it to run?



the temp.sql  file has this in it:

create database temp ;
USE DATABASE Temp;
CREATE TABLE Test_Table
(Test_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Test_Name VARCHAR(30),
Test_Date DATETIME,
Test_Giver VARCHAR(30));
INSERT INTO Test_Table
(Test_ID, Test_Name, Test_Date, Test_Giver)
VALUES
(null, 'Test', '2000-01-01', 'barb');












-
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

-
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




Re: how to run sql script in NT

2001-10-26 Thread Philip White

You don't need to be at the mysql prompt to run it, just run this from the
DOS prompt:

mysql temp.sql

and that will run mysql.exe and read everything from your temp.sql file.



- Original Message -
From: Barbara Ferrell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: barbara [EMAIL PROTECTED]
Sent: Friday, October 26, 2001 2:15 PM
Subject: how to run sql script in NT


 i am extremely new at this:

 i am on  NT4.0

 i am in a DOS screen at the mysql prompt (mysql)
 the path that is described in the top of the window is: =3D
 c:\apache\mysql\bin\mysql.exe


 i wrote a script to create and load a database exactly as it said in the =
 =3D
 book..  i saved the file as ..Temp.sql

 then i typed:
 mysql temp.sql ;  at the mysql prompt

 it doesn't recognize the .sql file... how do I get it to run?



 the temp.sql  file has this in it:

 create database temp ;
 USE DATABASE Temp;
 CREATE TABLE Test_Table
 (Test_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
 Test_Name VARCHAR(30),
 Test_Date DATETIME,
 Test_Giver VARCHAR(30));
 INSERT INTO Test_Table
 (Test_ID, Test_Name, Test_Date, Test_Giver)
 VALUES
 (null, 'Test', '2000-01-01', 'barb');












 -
 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



-
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




Re: how to run sql script in NT

2001-10-26 Thread Gerald Clark

I'm confused.
You say you are at a dos prompt, but you show a mysql prompt.

At the dos prompt do:

mysql  temp.sql

At the mysql prompt:

source temp.sql



Barbara Ferrell wrote:

 i am extremely new at this:
 
 i am on  NT4.0
 
 i am in a DOS screen at the mysql prompt (mysql)
 the path that is described in the top of the window is: =3D
 c:\apache\mysql\bin\mysql.exe
 
 
 i wrote a script to create and load a database exactly as it said in the =
 =3D
 book..  i saved the file as ..Temp.sql
 
 then i typed:
 mysql temp.sql ;  at the mysql prompt
 
 it doesn't recognize the .sql file... how do I get it to run?
 
 
 
 the temp.sql  file has this in it:
 
 create database temp ;
 USE DATABASE Temp;
 CREATE TABLE Test_Table
 (Test_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
 Test_Name VARCHAR(30),
 Test_Date DATETIME,
 Test_Giver VARCHAR(30));
 INSERT INTO Test_Table
 (Test_ID, Test_Name, Test_Date, Test_Giver)
 VALUES
 (null, 'Test', '2000-01-01', 'barb');
 
 
 
 
 
 
 
 
 
 
 
 
 -
 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


-- 
Gerald L. Clark
[EMAIL PROTECTED]


-
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