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 > Data Access, Manipulation & Batch Languages > ANSI SQL > How do I enumerate the database?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-03, 21:20
jasonvene jasonvene is offline
Registered User
 
Join Date: Jun 2003
Posts: 1
How do I enumerate the database?

I'm adapting C++ objects to ADO and ADOX for unmanaged targets, and ADOX doesn't appear to be able to fully enumerate the database.

So, I want to know who I can do that in SQL - something SQL92 can handle, so that MySQL, MSSQL2000, Interbase and others will be compatible with the approach.

From ADOX, I can get the entire list of catalogs (databases), then the tables within them, and all fields within the table. What I can't get are the columns within the Indexes or Keys. If I can just figure out how to get that information from SQL, I'd be set.

ADOX has the collections that supposedly provides an enumeration of the "Fields" within the Index, or "Fields" within the key, but attempting to get the "Count" or an "Item" from that collection causes an exception for MySQL and MSDE (MS SQL 2000).

Thanks.
Reply With Quote
  #2 (permalink)  
Old 07-01-03, 14:11
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 9,299
SQL Server isn't "object oriented" so you can't enumerate it like classes or collections. Instead, the information is stored in system table in the databases and in the master database. You can get information on fields and indexes from the syscolumns and sysindexes tables. You will have to know (or be prepared to learn) a lot about SQL Server's database engine if you want to do this.

blindman
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