How to put table definition into another table using SQL?

2010-05-11 Thread mos
I'd like to get the field names and data types of a table, say TableX, and put it into TableDef using nothing but SQL. I know I can list the table definition using Describe Table and then loop through the results and insert the first two columns Field and Type into TableDef, but is there a way

Re: How to put table definition into another table using SQL?

2010-05-11 Thread Nuno Tavares
create table TableDef like TableX ? -- Nuno Tavares DRI, Consultoria Informática Telef: +351 936 184 086 mos escreveu: I'd like to get the field names and data types of a table, say TableX, and put it into TableDef using nothing but SQL. I know I can list the table definition using

Re: How to put table definition into another table using SQL?

2010-05-11 Thread Phil
create table TableDEF like TableX; Or am I missing something ?? On Tue, May 11, 2010 at 11:36 AM, mos mo...@fastmail.fm wrote: I'd like to get the field names and data types of a table, say TableX, and put it into TableDef using nothing but SQL. I know I can list the table definition using

Re: How to put table definition into another table using SQL?

2010-05-11 Thread Anirudh Sundar
Hi Mike, Did you try this :- Create table TableDef select * from TableX where 1 = 2; If you give this statement you will create the new table TableDef with the same variables and datatypes as table TableX Let me know if it works Cheers, Anirudh Sundar On Tue, May 11, 2010 at 9:06 PM, mos

Re: How to put table definition into another table using SQL?

2010-05-11 Thread mos
At 10:53 AM 5/11/2010, Anirudh Sundar wrote: Hi Mike, Did you try this :- Create table TableDef select * from TableX where 1 = 2; If you give this statement you will create the new table TableDef with the same variables and datatypes as table TableX Let me know if it works Cheers,

Re: How to put table definition into another table using SQL?

2010-05-11 Thread Carlos Proal
Hi Mike, you need to query the information_schema schema/database that contains the database dictionary. You can read the manual or a beautiful diagram here: http://www.xcdsql.org/Misc/MySQL_INFORMATION_SCHEMA.html Have a nice day Carlos Proal On 5/11/2010 11:06 AM, mos wrote: At 10:53 AM

Re: How to put table definition into another table using SQL?

2010-05-11 Thread Anirudh Sundar
Hey Mike, I do not see a possibity of a quick response for this We need to work on a query (if at all it is possible to be done in a query). Will get back soon on this. Cheers, Anirudh Sundar On Tue, May 11, 2010 at 9:36 PM, mos mo...@fastmail.fm wrote: At 10:53 AM 5/11/2010, Anirudh

Re: How to put table definition into another table using SQL?

2010-05-11 Thread mos
At 11:23 AM 5/11/2010, Carlos Proal wrote: Hi Mike, you need to query the information_schema schema/database that contains the database dictionary. You can read the manual or a beautiful diagram here: http://www.xcdsql.org/Misc/MySQL_INFORMATION_SCHEMA.html Have a nice day Carlos Proal