SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 24th, 2004, 08:48 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question listing all tablenames in a database?

Is it possible to list all the tables in a database? I need to list the tablenames, is that possible with a .mdb database?

Only by using SQL, I want no frontend programming.

And is it possible to list all fieldnames of a known table.

All help appreciated
Lethean

Reply With Quote
  #2  
Old June 24th, 2004, 09:05 AM
timmyd timmyd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 8 timmyd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Is this something along the lines of what you want?
Code:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'


Tim Davis
The Hobbies of Tim Davis

Reply With Quote
  #3  
Old June 28th, 2004, 01:54 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy No doesn't work

No sadly it doesn't work, It misinterprets the "INFORMATION_SCHEMA" as a database.
Is this supposed to work? have you tried it?
Have anyone had the same problem?
Please someone must have had this problem.

Reply With Quote
  #4  
Old June 28th, 2004, 02:39 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 5 h 22 m 58 sec
Reputation Power: 259
Lethean, you should do your little effort to make timmyd's suggestion work ... in this case specify the right database to query:
Code:
SELECT TABLE_NAME FROM yourdatabasehere.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'

Reply With Quote
  #5  
Old June 28th, 2004, 03:15 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi pabloj, I have tried that and it still doesn't work i ran it as a query i ms access as well as through a vb code and neither will work. In access i get the following answer:

Could not find file 'C:\TEST.INFORMATION_SCHEMA'

I've tried with all manners of [ ] parenthesis combinations but none work can it be that it is an older type of access database or something like that? it is created with Access 2002

Reply With Quote
  #6  
Old June 28th, 2004, 06:00 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 5 h 22 m 58 sec
Reputation Power: 259
I'm sorry, I overlooked your post, my fault. The suggested query is fine for MsSQL aka SQLServer, not for MsAccess, which (here at DevShed) is usually addressed at the General Database forum.

That info for MsAccess should be in one hidden system object the MSysObjects table, look for Name and Type = 1 (which should be table if I remember well)

Reply With Quote
  #7  
Old June 28th, 2004, 07:09 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Great Thanks!!
That worked!

Reply With Quote
  #8  
Old June 28th, 2004, 09:20 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still have the problem with listing field or column names

I still have the problem with listing field or column names of a known table.

Reply With Quote
  #9  
Old August 25th, 2004, 05:56 AM
koneti_sri koneti_sri is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 koneti_sri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
query to get tablenames form a .mdb file

Quote:
Originally Posted by Lethean
Great Thanks!!
That worked!

Hi Lethean,
Can u please tell me, that select statement to get all table names form a .mdb file
thank u

Reply With Quote
  #10  
Old August 27th, 2004, 02:10 AM
Lethean Lethean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Gothenburg Sweden
Posts: 28 Lethean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Code:
Select * from MSysObjects where type = 1

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > listing all tablenames in a database?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway