|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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'
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
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) |
|
#7
|
|||
|
|||
|
Great Thanks!!
That worked! |
|
#8
|
|||
|
|||
|
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.
|
|
#9
|
|||
|
|||
|
query to get tablenames form a .mdb file
Quote:
Hi Lethean, Can u please tell me, that select statement to get all table names form a .mdb file thank u |
|
#10
|
|||
|
|||
|
Code:
Select * from MSysObjects where type = 1 |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > listing all tablenames in a database? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|