Re: Copying tables sans data from one database to another

2006-06-07 Thread Douglas Sims
Perhaps the easiest way is with CREATE TABLE... SELECT.  For example,  
if I have a database called NYCNH (by coincidence, I do!) which  
contains a table called checks and I want to copy that table to a  
database called TEST I could do this:


mysql create table test.checks select * from nycnh.checks;
Query OK, 80030 rows affected (0.88 sec)
Records: 80030  Duplicates: 0  Warnings: 0

and that would create a copy of the structure and data from checks  
and put it in the database test.


I believe this will not copy triggers or indexes from the original  
table.  If you need to do this, you can do it by using the mysqldump  
program to dump the table (just the structure or the structure and  
data) from the original database and then load it into the new one:  
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html


Good luck!

Douglas Sims
[EMAIL PROTECTED]



On Jun 7, 2006, at 8:09 PM, murthy gandikota wrote:


How can I copy tables from one database to another on the same host?

  Thanks for your help
  Murthy

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



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



Re: Copying tables sans data from one database to another

2006-06-07 Thread Dilipkumar

Hi,

It is

Rename table name to database.tablename.

db-1
db-2
rename db1.tablename to db2.tablename.

This might help you out.

murthy gandikota wrote:


How can I copy tables from one database to another on the same host?
  
 Thanks for your help

 Murthy

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 




--
Thanks  Regards,
Dilipkumar
DBA Support

** DISCLAIMER **
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail  notify us 
immediately at [EMAIL PROTECTED]


Watch India vs. England LIVE, Hot videos and more only on Sify Max! Click Here. 
www.sifymax.com

Get to see what's happening in your favourite City on Bangalore Live! 
www.bangalorelive.in


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