Update SQL table from data in another table 
Author Message
 Update SQL table from data in another table

So I go out and get this great book from WROX, Beginning ASP databases, it
has me immersed in VBScript, ASP WSH etc . . .
Anyway,
I'm trying to figure out how to script this logic using a plain .vbs.

'open connection to DB, start grabbing data and submitting it to the second
query.
SQL= "select uname, cname, ipaddress, comment from DB1.table1"
open conn1

for each ipaddress in DB.table1
do
    select * from DB2.table1 where DB1.table1.ipaddress =
DB2.table2.ipaddress
        open spreadsheet
        write data to excel spreadsheet.
        close spreadsheet
loop

close 1
close 2

I've got the spreadsheet part down now, I just need to know how to pass data
from one query to the next.

I have 250 + Excel reports to generate, and have tried every method I could
think of.
I was getting errors about already having a data source open when I tried to
open the second one.
I tried Arrays, thinking I could pass all the data from the first query to
either one array or 4 of them, that didn't work, couldn't create the array,
probably becuase I'm already in a foreach . . . do . . . loop.

Any help would be most appreciated.

TIA!

~Matt



Thu, 21 Oct 2004 08:09:46 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Updating Tables with SQL in VB6 using vfoxpro tables

2. Update table based on data in another table

3. Dataset changes updates grid , How to update SQL table

4. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

5. Help: updating text file-Updating Data in a linked table not supported by this ISAM

6. Using SQL commands in VBscript to update ACCESS table

7. Updating a field in SQL table

8. Using SQL commands in VBscript to update ACCESS table

9. Display table data from Access or SQL.

10. Update a Table from another Table without duplicates

11. update table field from xref table

12. !how VB update Table A INNER JOIN Table B, Set A.co=B.ID

 

 
Powered by phpBB® Forum Software