Unix Technical Forum

Nested Query with DESCRIBE

This is a discussion on Nested Query with DESCRIBE within the MySQL forums, part of the Database Server Software category; --> Hello, guys. Is that possible? I would like to retrieve a name of a column in order to process ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-13-2008, 01:59 PM
Ewgenij Sokolovski
 
Posts: n/a
Default Nested Query with DESCRIBE

Hello, guys. Is that possible? I would like to retrieve a name of a
column in order to process it then in my program. What I have written,
was:

'select Field from (describe My_Table);'

But MySQL answered with:

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'describe My_Table)' at line 1

So, what did I wrong? I can't see(

Greetings
Ewgenij

P.S. Do not write I should use the Information_Schema table, I know
that) But I have to implement the stuff on MySQL 4.1, and there is
no such table in this version.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-13-2008, 01:59 PM
Rik Wasmus
 
Posts: n/a
Default Re: Nested Query with DESCRIBE

On Thu, 12 Jun 2008 09:52:07 +0200, Ewgenij Sokolovski
<ewgenijkkg@compuserve.de> wrote:

> Hello, guys. Is that possible? I would like to retrieve a name of a
> column in order to process it then in my program. What I have written,
> was:
>
> 'select Field from (describe My_Table);'
>
> But MySQL answered with:
>
> You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'describe My_Table)' at line 1


AFAIK, you can't nest the DESCRIBE / SHOW commands as a subquery, or even
JOIN them for that matter. Why do you need to? This example just strips
some small unneeded data, which you could easily ignore in you application.

> P.S. Do not write I should use the Information_Schema table, I know
> that) But I have to implement the stuff on MySQL 4.1, and there is
> no such table in this version.


Alas.
--
Rik Wasmus
....spamrun finished
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-13-2008, 01:59 PM
Ewgenij Sokolovski
 
Posts: n/a
Default Re: Nested Query with DESCRIBE

> AFAIK, you can't nest the DESCRIBE / SHOW commands as a subquery, or even *
> JOIN them for that matter.


That's sad

Why do you need to? This example just strips *
> some small unneeded data, which you could easily ignore in you application..
>


Yeah, sure, I can write a workaround, but I wondered if it is possible
to implement the feature on the direct SQL way. Would look nicer But
OK, if that's not possible I have to program the other way.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com