From: Nuno Tavares Date: May 11 2010 3:46pm Subject: Re: How to put table definition into another table using SQL? List-Archive: http://lists.mysql.com/mysql/221549 Message-Id: <4BE97BED.6010609@dri.pt> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCD8BA44D3859249B2CA96C30" --------------enigCD8BA44D3859249B2CA96C30 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable create table TableDef like TableX ? --=20 Nuno Tavares DRI, Consultoria Inform=E1tica 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? >=20 > Example: > Describe TableX: >=20 > First_Name Char(15) .... > Last_Name Char(20) ... > Start_Date Date .. > Salary Double .. >=20 >=20 > And I'd like TableDef to have these rows: >=20 > ColName ColType > --------------- -------------- > First_Name Char(15) > Last_Name Char(20) > Start_Date Date > Salary Double >=20 > Is there a way to do this with one SQL statement? I'm really looking fo= r > the MySQL internal table where it stores the table definitions. >=20 > TIA > Mike >=20 >=20 --------------enigCD8BA44D3859249B2CA96C30 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkvpe+0ACgkQncah1swpSqhujgCeLmm/CpcMVLcRwCaqR9hfJIz/ JzIAoJrl2Uni7CFGRmNWW3dthfF+9MHL =kTYv -----END PGP SIGNATURE----- --------------enigCD8BA44D3859249B2CA96C30--