joelwenzel
Programmer
- Jun 28, 2002
- 448
Ok, I am setting up a DTS that must transfer data from one database to another. The thing is both databases are huge and fields must be multiplied, sumed, etc during the transfer. I started to solve the problem by using a large activeX script that was designed to handle all the cases but it was way to long and did not really allow for a lot of expansion. So instead, I've come up with this idea:
Have a lookup table that has the following fields
ToTable (table data being transferred to)
ToTableFieldName (the new field name in the new table)
Commands (a text field contain a bunch of TSQL commands that return the new value)
I then will have a vbscript that cycles through each element in the lookup table, and writes the commands in the proper format so that the return values can be inserted into the ToTable. The vb script will generate a TSQL script.
First, is there a better way of doing this? This way seems pretty good to me and seems to be easily changable
Second, how do I actually go about doing this? I need a way to load a TSQL file (that is generated from the vbscript) and execute it without having to do it manually. The TSQL file may contain procedures and functions so I cannot really execute it line by line.
Have a lookup table that has the following fields
ToTable (table data being transferred to)
ToTableFieldName (the new field name in the new table)
Commands (a text field contain a bunch of TSQL commands that return the new value)
I then will have a vbscript that cycles through each element in the lookup table, and writes the commands in the proper format so that the return values can be inserted into the ToTable. The vb script will generate a TSQL script.
First, is there a better way of doing this? This way seems pretty good to me and seems to be easily changable
Second, how do I actually go about doing this? I need a way to load a TSQL file (that is generated from the vbscript) and execute it without having to do it manually. The TSQL file may contain procedures and functions so I cannot really execute it line by line.