Re: spool log to a file

2008-07-30 Thread Ananda Kumar
The problem with below statement is that, if i there is any error in sql
statements it does not get written to 1.txt. So, even if there is any
error, how can i get it written to 1.txt.

mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt


On 7/29/08, Mary Bahrami [EMAIL PROTECTED] wrote:

 I use
 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt

 but it would be nice to see other solutions...


 -Original Message-
 From: Ananda Kumar [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 29, 2008 6:37 AM
 To: mysql
 Subject: spool log to a file

 Hi All,
 I am executing below command, but there is no entires in 1.txt, its
 an
 empty file. How can i write the logs into this file.

 mysql -uroot -pxxx  -Dtest  -s   --tee=1.txt -e  'select * from
 amc_25;'

 regards
 anandkl



Re: locked file mysqld-nt.exe when re-installing mysql on windows server

2008-07-30 Thread Ananda Kumar
got to

start--run--(type regedit)--HKEY_LOCAL_MACHINE---SOFTWARE
folder---delete all mysql folder

Then in SYSTEM Folder ---controlset001--services--- delete all mysql
entries. Do the same for controlset002 and controlset003

After above is done try to delete the file in C:\mysql\bin folder.

regards
anandkl


On 7/30/08, Johan Gant [EMAIL PROTECTED] wrote:

 Hi
 I'm reinstalling an instance of MySQL 4.1 on a Windows Server 2003 machine,
 but I cannot delete the original installation folder or re-install into it
 due to the presence of the mysqld-nt.exe file in the C:\mysql\bin folder.
 I've killed all services relating to MySQL (or those that I can clearly
 identify using task manager and the services list from admin tools) from
 all
 user sessions on that machine, but the file is still locked by some process
 which I cannot identify. I encountered this problem in the past and got
 around it by killing all MySQL related processes but this time it's not
 helping. I've also logged out any other user sessions on this machine to
 ensure there is nothing idling in the background.

 Short of rebooting the server - is there any way to find out what might be
 locking this file, or a way of forcing a release to allow me to reinstall
 MySQL? I'm happy to hear alternative suggestions as well.

 Thanks
 Johan



Re: locked file mysqld-nt.exe when re-installing mysql on windows server

2008-07-30 Thread Johan Gant
That worked for me, much appreciated.

Thanks

2008/7/30 Ananda Kumar [EMAIL PROTECTED]

 got to

 start--run--(type regedit)--HKEY_LOCAL_MACHINE---SOFTWARE
 folder---delete all mysql folder

 Then in SYSTEM Folder ---controlset001--services--- delete all mysql
 entries. Do the same for controlset002 and controlset003

 After above is done try to delete the file in C:\mysql\bin folder.

 regards
 anandkl


 On 7/30/08, Johan Gant [EMAIL PROTECTED] wrote:

 Hi
 I'm reinstalling an instance of MySQL 4.1 on a Windows Server 2003
 machine,
 but I cannot delete the original installation folder or re-install into it
 due to the presence of the mysqld-nt.exe file in the C:\mysql\bin folder.
 I've killed all services relating to MySQL (or those that I can clearly
 identify using task manager and the services list from admin tools) from
 all
 user sessions on that machine, but the file is still locked by some
 process
 which I cannot identify. I encountered this problem in the past and got
 around it by killing all MySQL related processes but this time it's not
 helping. I've also logged out any other user sessions on this machine to
 ensure there is nothing idling in the background.

 Short of rebooting the server - is there any way to find out what might be
 locking this file, or a way of forcing a release to allow me to reinstall
 MySQL? I'm happy to hear alternative suggestions as well.

 Thanks
 Johan





Re: spool log to a file

2008-07-30 Thread Ananda Kumar
Thank u, this works.

On 7/30/08, Jim Lyons [EMAIL PROTECTED] wrote:

 Try:

 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt 2
 1.txt

 or

 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt 2
 1.errs

 This will redirect STDERR.  This works in Linux/Unix.  I don't know about
 windows.

 On Wed, Jul 30, 2008 at 1:51 AM, Ananda Kumar [EMAIL PROTECTED] wrote:

 The problem with below statement is that, if i there is any error in sql
 statements it does not get written to 1.txt. So, even if there is any
 error, how can i get it written to 1.txt.

 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt



  On 7/29/08, Mary Bahrami [EMAIL PROTECTED] wrote:
 
  I use
  mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt
 
  but it would be nice to see other solutions...
 
 
  -Original Message-
  From: Ananda Kumar [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, July 29, 2008 6:37 AM
  To: mysql
  Subject: spool log to a file
 
  Hi All,
  I am executing below command, but there is no entires in 1.txt, its
  an
  empty file. How can i write the logs into this file.
 
  mysql -uroot -pxxx  -Dtest  -s   --tee=1.txt -e  'select * from
  amc_25;'
 
  regards
  anandkl
 





 --
 Jim Lyons
 Web developer / Database administrator
 http://www.weblyons.com



Re: spool log to a file

2008-07-30 Thread walter harms

that is a shell question using bash/ksh stuff you can use this:

mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt 21


Ananda Kumar wrote:
 The problem with below statement is that, if i there is any error in sql
 statements it does not get written to 1.txt. So, even if there is any
 error, how can i get it written to 1.txt.
 
 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt
 
 
 On 7/29/08, Mary Bahrami [EMAIL PROTECTED] wrote:
 I use
 mysql -uroot -pxxx  -Dtest  -s -e  'select * from amc_25;'  1.txt

 but it would be nice to see other solutions...


 -Original Message-
 From: Ananda Kumar [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 29, 2008 6:37 AM
 To: mysql
 Subject: spool log to a file

 Hi All,
 I am executing below command, but there is no entires in 1.txt, its
 an
 empty file. How can i write the logs into this file.

 mysql -uroot -pxxx  -Dtest  -s   --tee=1.txt -e  'select * from
 amc_25;'

 regards
 anandkl

 

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



Re-arranging fields

2008-07-30 Thread Jerry Schwartz
Is there any reasonable way of re-arranging the order of columns in a table
without losing their data? The best I could come up with was to copy the
table, empty it, and then do an INSERT . SELECT specifying the new order of
the fields.

 

 

 

Regards,

 

Jerry Schwartz

The Infoshop by Global Information Incorporated

195 Farmington Ave.

Farmington, CT 06032

 

860.674.8796 / FAX: 860.674.8341

 

 http://www.the-infoshop.com www.the-infoshop.com

 http://www.giiexpress.com www.giiexpress.com

www.etudes-marche.com



Re: Re-arranging fields

2008-07-30 Thread Ranjeet Walunj

Jerry Schwartz wrote:

Is there any reasonable way of re-arranging the order of columns in a table
without losing their data? The best I could come up with was to copy the
table, empty it, and then do an INSERT . SELECT specifying the new order of
the fields.


This can also be achieved in following manner.

a) Rename table to tablename_new
b) create table Tablename (fieldnames and datatypes) Select 
field1,field2...fieldn from tablename_new;


But why do you want to do it in first place ?

Regards,
Ranjeet Walunj

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



Re: Re-arranging fields

2008-07-30 Thread Rob Wultsch
Something like
ALTER TABLE [TABLE] MODIFY [COLUMN] col_name column_definition
[FIRST | AFTER col_name]
shoudl work

http://dev.mysql.com/doc/refman/5.0/en/alter-table.html


On Wed, Jul 30, 2008 at 11:42 AM, Jerry Schwartz
[EMAIL PROTECTED] wrote:
 Is there any reasonable way of re-arranging the order of columns in a table
 without losing their data? The best I could come up with was to copy the
 table, empty it, and then do an INSERT . SELECT specifying the new order of
 the fields.







 Regards,



 Jerry Schwartz

 The Infoshop by Global Information Incorporated

 195 Farmington Ave.

 Farmington, CT 06032



 860.674.8796 / FAX: 860.674.8341



  http://www.the-infoshop.com www.the-infoshop.com

  http://www.giiexpress.com www.giiexpress.com

 www.etudes-marche.com





-- 
Rob Wultsch
[EMAIL PROTECTED]
wultsch (aim)

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



Re: Re-arranging fields

2008-07-30 Thread Mr. Shawn H. Corey
On Wed, 2008-07-30 at 14:42 -0400, Jerry Schwartz wrote:
 Is there any reasonable way of re-arranging the order of columns in a table
 without losing their data? The best I could come up with was to copy the
 table, empty it, and then do an INSERT . SELECT specifying the new order of
 the fields.

According to RDB theory, the order of the columns is immaterially, just
as is the order of the rows.  You should always explicitly name the
columns in the order you want.  Relying on their default order can lead
to problems down the road.


-- 
Just my 0.0002 million dollars worth,
  Shawn

Where there's duct tape, there's hope.

Perl is the duct tape of the Internet.
Hassan Schroeder, Sun's first webmaster


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



COUNT returned rows of a SELECT

2008-07-30 Thread Fish Kungfu
Using MySQL commands only (not PHP's mysql_num_rows), is there a way to
COUNT the number of rows returned from a SELECT.GROUP BY?

My primary SELECT query is this:

SELECT aviName,MAX(dateTime) FROM aviTrackerMain WHERE DATE(dateTime)
LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName;

And it faithfully returns x-number of rows.  However, I want to be able
to capture the number of rows it returns.  If I have to I will use PHP,
but I was hoping for a way to do it with just MySQL.


Thanks very much in advance..Fish


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



Re: COUNT returned rows of a SELECT

2008-07-30 Thread Ananda Kumar
SELECT aviName,MAX(dateTime) ,count(*) FROM aviTrackerMain WHERE
DATE(dateTime)
LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName;


This will also give you count of rows



On 7/31/08, Fish Kungfu [EMAIL PROTECTED] wrote:

 Using MySQL commands only (not PHP's mysql_num_rows), is there a way to
 COUNT the number of rows returned from a SELECT.GROUP BY?

 My primary SELECT query is this:

 SELECT aviName,MAX(dateTime) FROM aviTrackerMain WHERE DATE(dateTime)
 LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName;

 And it faithfully returns x-number of rows.  However, I want to be able
 to capture the number of rows it returns.  If I have to I will use PHP,
 but I was hoping for a way to do it with just MySQL.


 Thanks very much in advance..Fish


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