dbTalk Databases Forums  

ASA9.0.2 Search same field through the database

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss ASA9.0.2 Search same field through the database in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger Peffers
 
Posts: n/a

Default ASA9.0.2 Search same field through the database - 03-26-2010 , 03:51 AM






Hi All

I have a simple but annoying problem. Our vendor supplies use with a
database with 170 tables. The database is primarily driven from a
customer table with a char(15) contact_code which is the primary key.
This contact_code can be used throughout many of the 150 tables but
the field is not always labeled contact_code.

Can I write a script that returns all the table and fields that are
char(15) and owned by the administrator?

Thanks in advance

Regards

Roger

Reply With Quote
  #2  
Old   
dantheguy
 
Posts: n/a

Default Re: ASA9.0.2 Search same field through the database - 03-26-2010 , 07:26 AM






On Mar 26, 4:51*am, Roger Peffers <rpeff... (AT) gmail (DOT) com> wrote:
Quote:
Hi All

I have a simple but annoying problem. *Our vendor supplies use with a
database with 170 tables. *The database is primarily driven from a
customer table with a char(15) contact_code which is the primary key.
This contact_code can be used throughout many of the 150 tables but
the field is not always labeled contact_code.

Can I write a script that returns all the table and fields that are
char(15) and owned by the administrator?

Thanks in advance

Regards

Roger
You can use "SELECT * from sys.syscolumn c, sys.systable t WHERE
c.table_id = t.table_id AND t.creator = user_id('Administrator')' and
c.width = 15"

However I'm not certain how to get the actual type of the column
unless it's a user defined type. In 11 at least column_type appears
to be either C for a computed column or R for other columns. Maybe
someone else has the answer to that.

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.