Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Find Field Type And Length?

This is a discussion on Find Field Type And Length?, within the MySQL section. This forum and the thread "Find Field Type And Length?" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Find Field Type And Length?
Jason
post Apr 14 2008, 10:45 AM
Post #1


Master of the Universe
Group Icon

Posts: 1,297
Joined: 15-February 08
From: London, England


A bit like the title suggests. How can I find out the Field type and field length in a database table?


--------------------
Go to the top of the page
 
+Quote Post
paintingtheweb
post Apr 14 2008, 12:23 PM
Post #2


Squeezing
***

Posts: 76
Joined: 14-February 08
From: Las Vegas, NV


QUOTE (Jason @ Apr 14 2008, 08:45 AM) *
A bit like the title suggests. How can I find out the Field type and field length in a database table?

Are you talking about finding this out through code?


--------------------
http://www.infoonmike.com

"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." Martin Golding
Go to the top of the page
 
+Quote Post
Jason
post Apr 14 2008, 12:52 PM
Post #3


Master of the Universe
Group Icon

Posts: 1,297
Joined: 15-February 08
From: London, England


I want a query which instead of telling me what is in the table, will tell me about the table.

So

title - varchar(120)

All I am interested in getting is the Field name, field type and field length. The contents of the table are of no interest to me.

I am looking to do this in an SQL query.


--------------------
Go to the top of the page
 
+Quote Post
Rakuli
post Apr 14 2008, 03:49 PM
Post #4


Squeeze Machine
Group Icon

Posts: 760
Joined: 13-February 08
From: Catching the squeezed drips downunder.


You can use either EXPLAIN, DESCRIBE or SHOW COLUMNS to get information about a table and its columns.

CODE
SHOW COLUMNS FROM tableName
WHERE `Columns` LIKE 'columnName'
---

EXPLAIN tableName
---
DESCRIBE tableName


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: