Unix Technical Forum

searching for a column

This is a discussion on searching for a column within the pgsql Databases forums, part of the PostgreSQL category; --> I have a (hopefully) very simple question:- How can I search through a database for a specific column name? ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Databases

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 11:25 PM
Max Coppin
 
Posts: n/a
Default searching for a column

I have a (hopefully) very simple question:-

How can I search through a database for a specific column name? I'm trying
to reverse-engineer some reports and this would make my life much easier.

Thanks


maxcoppin@humphreyfarms.com



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 11:26 PM
Max Coppin
 
Posts: n/a
Default Re: searching for a column

This just gives me a syntax error. Any more ideas?

"Peter de Vries" <peter@devnull.local> wrote in message
news:slrnbgr11t.19c.P.de.Vries@tux.thuis.local...
> Max Coppin wrote:
> > I have a (hopefully) very simple question:-

>
> > How can I search through a database for a specific column name? I'm
> > trying to reverse-engineer some reports and this would make my life
> > much easier.

>
> FOR EACH _field NO-LOCK
> WHERE _field-name = "field to find",
> FIRST _file OF _field NO-LOCK:
>
> DISPLAY _file-name _field-name.
>
> END.
>
> Is that what you mean?
>
> --
> Peter de Vries, ICQ 7787398



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:26 PM
Kevin
 
Posts: n/a
Default Re: searching for a column

"Max Coppin" <maxcoppin@humphreyfarms.com> wrote in news:bfj7h6$qp6$1
@hercules.btinternet.com:

> This just gives me a syntax error. Any more ideas?
>
>> FOR EACH _field NO-LOCK
>> WHERE _field-name = "field to find",
>> FIRST _file OF _field NO-LOCK:
>>
>> DISPLAY _file-name _field-name.
>>
>> END.
>>


The code works for me.. Did you change "Field to find" to the name of the
field you are looking for?? What kind of error are you receiving??

Kevin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 11:26 PM
Max Coppin
 
Posts: n/a
Default Re: searching for a column

I get a syntax error:-

=== SQL Exception 1 ===
SQLState=42000
ErrorCode=-20003
[JDBC Progress Driver]:Syntax error (7587)

i typed in this:-

FOR EACH _field NO-LOCK
WHERE _field-name = "ORDER_NUMBER",
FIRST _file OF _field NO-LOCK:

DISPLAY _file-name _field-name.

END.

"Kevin" <Joe@Joe.com> wrote in message
news:Xns93C0C327B81F0JoeJoecom@195.8.68.206...
> "Max Coppin" <maxcoppin@humphreyfarms.com> wrote in news:bfj7h6$qp6$1
> @hercules.btinternet.com:
>
> > This just gives me a syntax error. Any more ideas?
> >
> >> FOR EACH _field NO-LOCK
> >> WHERE _field-name = "field to find",
> >> FIRST _file OF _field NO-LOCK:
> >>
> >> DISPLAY _file-name _field-name.
> >>
> >> END.
> >>

>
> The code works for me.. Did you change "Field to find" to the name of the
> field you are looking for?? What kind of error are you receiving??
>
> Kevin




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 11:26 PM
Max Coppin
 
Posts: n/a
Default Re: searching for a column

I've tried the pub. suffix but get the same error. Only _field should have
the suffix i presume?


"Kevin" <Joe@Joe.com> wrote in message
news:Xns93C1D9381C48DJoeJoecom@195.8.68.206...
> "Max Coppin" <maxcoppin@humphreyfarms.com> wrote in
> news:bflj2l$rcn$1@sparta.btinternet.com:
>
> > I get a syntax error:-
> >
> > === SQL Exception 1 ===
> > SQLState=42000
> > ErrorCode=-20003
> > [JDBC Progress Driver]:Syntax error (7587)
> >
> > i typed in this:-
> >
> > FOR EACH _field NO-LOCK
> > WHERE _field-name = "ORDER_NUMBER",
> > FIRST _file OF _field NO-LOCK:
> >
> > DISPLAY _file-name _field-name.
> >
> > END.
> >

>
>
> Ahh.. This is 4GL, code not SQL.. The same table names should work just
> fine, but be sure to use the pub suffix..
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-09-2008, 11:27 PM
Grant Dyer
 
Posts: n/a
Default Re: searching for a column

_file should have the suffix as well

"Max Coppin" <maxcoppin@humphreyfarms.com> wrote in message
news:bfon07$jh4$1@sparta.btinternet.com...
> I've tried the pub. suffix but get the same error. Only _field should

have
> the suffix i presume?
>
>
> "Kevin" <Joe@Joe.com> wrote in message
> news:Xns93C1D9381C48DJoeJoecom@195.8.68.206...
> > "Max Coppin" <maxcoppin@humphreyfarms.com> wrote in
> > news:bflj2l$rcn$1@sparta.btinternet.com:
> >
> > > I get a syntax error:-
> > >
> > > === SQL Exception 1 ===
> > > SQLState=42000
> > > ErrorCode=-20003
> > > [JDBC Progress Driver]:Syntax error (7587)
> > >
> > > i typed in this:-
> > >
> > > FOR EACH _field NO-LOCK
> > > WHERE _field-name = "ORDER_NUMBER",
> > > FIRST _file OF _field NO-LOCK:
> > >
> > > DISPLAY _file-name _field-name.
> > >
> > > END.
> > >

> >
> >
> > Ahh.. This is 4GL, code not SQL.. The same table names should work just
> > fine, but be sure to use the pub suffix..
> >

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-09-2008, 11:27 PM
Grant Dyer
 
Posts: n/a
Default Re: searching for a column

Correction: This thread has talked about a suffix. It is really a prefix
as in PUB._file and PUB._field
"Grant Dyer" <grant.dyer@bigpond.com> wrote in message
news:51z_a.32872$bo1.30426@news-server.bigpond.net.au...
> _file should have the suffix as well
>
> "Max Coppin" <maxcoppin@humphreyfarms.com> wrote in message
> news:bfon07$jh4$1@sparta.btinternet.com...
> > I've tried the pub. suffix but get the same error. Only _field should

> have
> > the suffix i presume?
> >
> >
> > "Kevin" <Joe@Joe.com> wrote in message
> > news:Xns93C1D9381C48DJoeJoecom@195.8.68.206...
> > > "Max Coppin" <maxcoppin@humphreyfarms.com> wrote in
> > > news:bflj2l$rcn$1@sparta.btinternet.com:
> > >
> > > > I get a syntax error:-
> > > >
> > > > === SQL Exception 1 ===
> > > > SQLState=42000
> > > > ErrorCode=-20003
> > > > [JDBC Progress Driver]:Syntax error (7587)
> > > >
> > > > i typed in this:-
> > > >
> > > > FOR EACH _field NO-LOCK
> > > > WHERE _field-name = "ORDER_NUMBER",
> > > > FIRST _file OF _field NO-LOCK:
> > > >
> > > > DISPLAY _file-name _field-name.
> > > >
> > > > END.
> > > >
> > >
> > >
> > > Ahh.. This is 4GL, code not SQL.. The same table names should work

just
> > > fine, but be sure to use the pub suffix..
> > >

> >
> >

>
>



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 05:37 AM.


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