List:General Discussion« Previous MessageNext Message »
From:Nuno Tavares Date:May 11 2010 3:46pm
Subject:Re: How to put table definition into another table using SQL?
View as plain text  
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 "Describe Table" and then loop through the
> results and insert the first two columns Field and Type into TableDef,
> but is there a way to do it using just SQL?
> 
> Example:
> Describe TableX:
> 
> First_Name    Char(15)  ....
> Last_Name    Char(20) ...
> Start_Date    Date  ..
> Salary        Double  ..
> 
> 
> And I'd like TableDef to have these rows:
> 
> ColName    ColType
> ---------------             --------------
> First_Name    Char(15)
> Last_Name    Char(20)
> Start_Date    Date
> Salary        Double
> 
> Is there a way to do this with one SQL statement? I'm really looking for
> the MySQL internal table where it stores the table definitions.
> 
> TIA
> Mike
> 
> 


Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
How to put table definition into another table using SQL?mos11 May
  • Re: How to put table definition into another table using SQL?Nuno Tavares11 May
  • Re: How to put table definition into another table using SQL?Phil11 May
  • Re: How to put table definition into another table using SQL?Anirudh Sundar11 May
    • Re: How to put table definition into another table using SQL?mos11 May
      • Re: How to put table definition into another table using SQL?Carlos Proal11 May
        • Re: How to put table definition into another table using SQL?mos11 May
      • Re: How to put table definition into another table using SQL?Anirudh Sundar11 May