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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select * table names from database. 3

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
I need to get all of the table names from a database to populate a list box in VB. Can anyone please give me a little sample SQL Statement to select all of them.

I use SQL Server 7.0

TIA Every day above ground is a GOOD DAY!!!
 
Select name from databasename.sysobjects where xtype = 'U'
That should work for you. Ashley L Rickards
SQL DBA
 
Alternatively you can use the

sp_helpdb

stored procedure.


 
ASH001, works like a dream thanks.

Lachie, I don't see a sp_helpdb stored procedure, but I'll continue to look for it.

I'm just getting into SQL and VB so I may be kind of slow.

Thanks again to both of you. Every day above ground is a GOOD DAY!!!
 

sp_helpdb is in the master database. It a system stored procedure that can be executed within the context of any database. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
The SQL Statement that ASH001 recommends works well, but it returns a table called "dtproperties" and I don't want it to be in the listbox with the other table names. Is there a way to omit this table and just populate the list box with the remaining table names. Every day above ground is a GOOD DAY!!!
 
Add "and name not like 'dtproprerties' in the where statement. Ashley L Rickards
SQL DBA
 
Worked like a dream ASH001. Thanks a million. I really appreaciate all of you taking the time to answer. Rob
Just my $.02.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top