How can I retreive the table names hosted on a SQL server? 
Author Message
 How can I retreive the table names hosted on a SQL server?

Hi,

I'm building a class creator for some of the SQL servers we have and instead
of having the users typing  the name of each table they want to create a
class from, I'd like to automatically populate a combo box with them...

So, once I made the connection to the appropriate database (using
ODBCDirect) how can I get the table names?

Thanks!

julien.



Fri, 18 May 2001 03:00:00 GMT  
 How can I retreive the table names hosted on a SQL server?
You could a query like

Select name from sysobjects where type = 'U'

Robert Joiner

Quote:

>Hi,

>I'm building a class creator for some of the SQL servers we have and
instead
>of having the users typing  the name of each table they want to create a
>class from, I'd like to automatically populate a combo box with them...

>So, once I made the connection to the appropriate database (using
>ODBCDirect) how can I get the table names?

>Thanks!

>julien.



Sat, 19 May 2001 03:00:00 GMT  
 How can I retreive the table names hosted on a SQL server?
If you're using ODBCDirect, that means you are using the DAO object model
with ODBC, correct?  Why not just loop through the TableDef objects in a
For...Next loop to get the names?


Sat, 19 May 2001 03:00:00 GMT  
 How can I retreive the table names hosted on a SQL server?
I personally prefer to use sp_tables stored procedure with SQL Server 6.5.
With this stored procedure, at least Microsoft will preserve this sp on SQL
Server 7.0 (can anyone confirm this?)

  With mCon
    .ConnectionString = "uid=guest;pwd=guest;dsn=pubs"
    .Open
  End With

  mCmd.CommandText = "sp_tables"
  mCmd.CommandType = adCmdStoredProc
  Set mCmd.ActiveConnection = mCon

  Set mRS = mCmd.Execute

  Do while Not mRS.EOF

    If mRS.Fields("TABLE_TYPE").Value = "TABLE" Then
      ListBox1.AddItem mRS.Fields("TABLE_NAME").Value
    End If

    mRS.MoveNext
  Loop

Quote:

>Hi,

>I'm building a class creator for some of the SQL servers we have and
instead
>of having the users typing  the name of each table they want to create a
>class from, I'd like to automatically populate a combo box with them...

>So, once I made the connection to the appropriate database (using
>ODBCDirect) how can I get the table names?

>Thanks!

>julien.



Sun, 20 May 2001 03:00:00 GMT  
 How can I retreive the table names hosted on a SQL server?
Japp!



/MT

Quote:

>I personally prefer to use sp_tables stored procedure with SQL Server 6.5.
>With this stored procedure, at least Microsoft will preserve this sp on SQL
>Server 7.0 (can anyone confirm this?)

>  With mCon
>    .ConnectionString = "uid=guest;pwd=guest;dsn=pubs"
>    .Open
>  End With

>  mCmd.CommandText = "sp_tables"
>  mCmd.CommandType = adCmdStoredProc
>  Set mCmd.ActiveConnection = mCon

>  Set mRS = mCmd.Execute

>  Do while Not mRS.EOF

>    If mRS.Fields("TABLE_TYPE").Value = "TABLE" Then
>      ListBox1.AddItem mRS.Fields("TABLE_NAME").Value
>    End If

>    mRS.MoveNext
>  Loop


>>Hi,

>>I'm building a class creator for some of the SQL servers we have and
>instead
>>of having the users typing  the name of each table they want to create a
>>class from, I'd like to automatically populate a combo box with them...

>>So, once I made the connection to the appropriate database (using
>>ODBCDirect) how can I get the table names?

>>Thanks!

>>julien.



Mon, 21 May 2001 03:00:00 GMT  
 How can I retreive the table names hosted on a SQL server?
If you wish to do those kinds of things then you may want to look into
using SQL DMO.
Quote:
-----Original Message-----

Posted At: Wednesday, December 02, 1998 6:51 AM
Posted To: database
Conversation: How can I retreive the table names hosted on a SQL server?
Subject: Re: How can I retreive the table names hosted on a SQL server?

I personally prefer to use sp_tables stored procedure with SQL Server
6.5.
With this stored procedure, at least Microsoft will preserve this sp on
SQL
Server 7.0 (can anyone confirm this?)

  With mCon
    .ConnectionString = "uid=guest;pwd=guest;dsn=pubs"
    .Open
  End With

  mCmd.CommandText = "sp_tables"
  mCmd.CommandType = adCmdStoredProc
  Set mCmd.ActiveConnection = mCon

  Set mRS = mCmd.Execute

  Do while Not mRS.EOF

    If mRS.Fields("TABLE_TYPE").Value = "TABLE" Then
      ListBox1.AddItem mRS.Fields("TABLE_NAME").Value
    End If

    mRS.MoveNext
  Loop


>Hi,

>I'm building a class creator for some of the SQL servers we have and
instead
>of having the users typing  the name of each table they want to create
a
>class from, I'd like to automatically populate a combo box with them...

>So, once I made the connection to the appropriate database (using
>ODBCDirect) how can I get the table names?

>Thanks!

>julien.



Sun, 27 May 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. DCount, DLookUp with SQL Server table names...

2. Getting table names from an SQL-Server DB

3. Extra constaint name occure in SQL Server if upsize table from access

4. how do I get all table name from SQL Server 7.0

5. Getting tables name from SQL Server via ADO

6. HOW TO RETREIVE DATA FROM SQL SERVER USING RDO

7. How do I retreive a list of SQL servers on local network

8. Retreive SQL servers on Local Network

9. All records retreived from SQL server with DataGrid

10. Retreiving .bmp image from SQL Server 2000

11. Retreiving recordset through ADO from a SQL-server database generates timeout errors

12. All records retreived from SQL server with DataGrid

 

 
Powered by phpBB® Forum Software