Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retreiving MS SQL Database table names.

Status
Not open for further replies.

moki

Programmer
Dec 5, 2000
37
0
0
Hello,

I have been able to retrieve Access database table names but want to be able to do it on an SQL database.

The code I use for Access is:

Set db = OpenDatabase(MyDatabaseName)

For intI = 0 To db.Containers("Tables").Documents.Count - 1
If Left(db.Containers("Tables").Documents(intI).Name, 4) <> "MSys" Then
cboTables.AddItem db.Containers("Tables").Documents(intI).Name
End If
Next intI

Can someone direct me in getting SQL table names?

Thank you....
 
see this thread for ideas:

thread222-902271



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Thank you for your reply DrJavaJoe,

I found a method that will do the trick. Don't know if this will help anyone but I have posted it for reference.

GobjRs_Archive.Open "select name from sysobjects where xtype = 'U'", GobjConn, adOpenStatic, adLockPessimistic

For intI = 0 To GobjRs_Archive.RecordCount - 1
Debug.Print GobjRs_Archive("name")
GobjRs_Archive.MoveNext
Next intI

Thank you....
 
SQL Server has a system view called INFORMATION_SCHEMA that you can query to find meta information. It's detailed in the SQL Server BooksOnLine (the help collection).

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thank you Chiph, that looks like a better way of retrieving information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top