My pleasure!

Emmanuel

--- In advanced_delphi@yahoogroups.com, "rmiller571957" <rmil...@...> 
wrote:
>
> Emmanuel,
> That worked perfectly.  Thanks!
> - Regina
> 
> --- In advanced_delphi@yahoogroups.com, "Emmanuel Lamy" <lamye@> 
wrote:
> >
> > if you are using MS SQL 2005 or a later version of MS SQL, you 
may 
> > stream in a clientdataset, the contents of the "sys.tables" of 
the 
> > database you want to query about just as you would with an 
ordinary 
> > table in the database on the server. The column "name" will list 
the 
> > name of all the tables in the database.
> > 
> > ...
> > with adoConn1 do
> > begin
> >     try
> >         DefaultDatabase:='YourDatabase';
> >     finally
> >         Connected:=true;
> >     end;
> > end;
> > 
> > with adoTable1 do
> > begin
> >     Connection:=adoConn1;
> >     TableName:='YourDatabase.sys.tables';
> > end;
> > 
> > dProvider1.dataset:=adoTable1;
> > 
> > with clientDataset1 do
> > begin
> >     SetProvider(dProvider1);
> >     Active:=true;
> > end;
> > ...
> > 
> > The list of your table names will be shown in the column "name". 
HTH.
> > 
> > Emmanuel Lamy
> > 
> > --- In advanced_delphi@yahoogroups.com, "Regina Miller" 
<rmiller@> 
> > wrote:
> > >
> > > Hi,
> > > 
> > > I would like to use Delphi to get a list of all of the tables 
in 
> > all of
> > > the databases on our sql server.
> > > 
> > >  
> > > 
> > > So I start by doing an "sp_databases" query to get all of the 
> > databases.
> > > 
> > >  
> > > 
> > > I have a separate ado connection string that I use to get the 
tables
> > > that doesn't have an "initial catalog" in it.  I close that 
> > connection,
> > > append an "initial catalog=" + the first database name, and 
reopen 
> > it.
> > > 
> > > Then on my tables query, which is pointing to the newly changed
> > > connection string, I am doing an "sp_tables".
> > > 
> > > But, that command returns all of the tables in the Master 
database, 
> > not
> > > the database(s) I care about.
> > > 
> > >  
> > > 
> > > I've checked, and my connection string definitely says "initial
> > > catalog=xxxx" where xxxx really is the first database I want to 
get 
> > all
> > > the tables for.  And my tables query is definitely pointing to 
that
> > > changed connection string.
> > > 
> > >  
> > > 
> > > Any suggestions?
> > > 
> > >  
> > > 
> > > Thanks,
> > > 
> > > Regina
> > > 
> > >  
> > > 
> > >  
> > > 
> > > Regina Miller
> > > 
> > > Lead Analyst, Grays Harbor County
> > > 
> > > (360) 249-4144  ext  457
> > > 
> > > rmiller@
> > >
> >
>


Reply via email to