Search multiple (unlimited) tables in one Database

Results 1 to 2 of 2

Thread: Search multiple (unlimited) tables in one Database

  1. #1
    Brian Altman Guest

    Default Search multiple (unlimited) tables in one Database

    Does anybody know how to search all tables within a single database, no matter how many tables are in that database?<BR>Could this be done by using aliases/loops ? Help please !!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Search multiple (unlimited) tables in one Data

    Here&#039s some quick and dirty code to write all the table names out. I&#039ll let you figure out how to capture each name for use in an SQL query.<BR><BR><BR>&#060;%@ language="vbscript" %&#062;<BR>&#060;!-- #include virtual="/" --&#062;<BR>&#060;%<BR>&#039Change the path in the connection string to your database accordingly<BR><BR>dim sConnection<BR>dim oConnection<BR>dim oRecordset<BR>set oConnection = Server.CreateObject("ADODB.Connection")<BR>sConnec tion = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:Program FilesMicrosoft Visual StudioVB98
    wind.mdb"<BR>oConnection.Open sConnection<BR>Set oRecordset = oConnection.OpenSchema(adSchemaTables)<BR> Do Until oRecordset.EOF<BR> If oRecordset.Fields("TABLE_TYPE") &#060;&#062; "VIEW" Then<BR> response.write oRecordset.Fields("TABLE_NAME") & "&lt;BR&gt;"<BR> End If<BR> oRecordset.MoveNext<BR> Loop<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts