Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > Query to find a particular column name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-15-03, 01:28
Anu_R Anu_R is offline
Registered User
 
Join Date: Jun 2003
Posts: 38
Question Query to find a particular column name

Hi,

I have sybase ASE 12.0. Under the master database, I have user-defined tables (say 10 of them) created with different column names.

I need to write a query to be executed via isql that finds if any of the tables have a particular column name. For example, I need to find in which of the 10 tables, the column name is 'val'.

I know that the list of user defined tables can be queried using:
SELECT * from sysobjects where type = 'U'

Thanks!!
Anu_R
Reply With Quote
  #2 (permalink)  
Old 07-15-03, 01:44
frankp frankp is offline
Registered User
 
Join Date: Jan 2003
Posts: 26
Re: Query to find a particular column name

Try this:
select a.name
from sysobjects a, syscolumns b
where a.id = b.id
and b.name = 'column name'

Frank
Reply With Quote
  #3 (permalink)  
Old 07-15-03, 06:00
Anu_R Anu_R is offline
Registered User
 
Join Date: Jun 2003
Posts: 38
Re: Query to find a particular column name

Quote:
Originally posted by frankp
Try this:
select a.name
from sysobjects a, syscolumns b
where a.id = b.id
and b.name = 'column name'

Frank



Thanks Frank!! this helped.

Anu_R

Last edited by Anu_R : 07-15-03 at 06:09.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On