This is my first attempt at a VBScript within a DTS package but it is far too slow.
What I am trying to do is insert around 3Million records and Lookup a couple of values at the same time.
My thinking was that this would be faster but it does not seem to be the case.
I have two lookups the first is called GetNewPatNo and looks like this...
The second is called GetCentreCode and looks like this ...
The following is my VBScript within the same DTS Package
The question is, should this be so slow ?, the reason I ask is that I run some tests without the lookup and it was much quicker, it even seemed much quicker doing an update of the two columns AFTER the insert.
Thanks for any advice
Dave
What I am trying to do is insert around 3Million records and Lookup a couple of values at the same time.
My thinking was that this would be faster but it does not seem to be the case.
I have two lookups the first is called GetNewPatNo and looks like this...
Code:
SELECT Patient_Number
FROM PATIENT_NUMBERS
WHERE (Old_Code = ?) AND (Conversion_Database = ?)
The second is called GetCentreCode and looks like this ...
Code:
SELECT Centre_Code
FROM PATIENT_NUMBERS
WHERE (Old_Code = ?) AND (Conversion_Database = ?)
The following is my VBScript within the same DTS Package
Code:
Dim tCounter
Dim tUniqueID
Dim tNewPatNo
Dim tCentreCode
Dim tDatabaseNo
Function Main()
tDatabaseNo=3
tCounter = tCounter + 1
tUniqueID = Right("0000000" & tCounter, 8)
tNewPatNo = DTSLookups("GetNewPatNo").Execute(DTSSource("User.Ref"),tDatabaseNo)
tCentreCode = DTSLookups("GetCentreCode").Execute(DTSSource("User.Ref"),tDatabaseNo)
DTSDestination("Patient_Number") =tNewPatNo
DTSDestination("Patient_No_Full") =tCentreCode&tNewPatNo
DTSDestination("Old_Pat_Number") = DTSSource("User.Ref")
DTSDestination("Details") = DTSSource("NOTE-DESC")
DTSDestination("Entered_By") = DTSSource("GN-AUTHOR")
DTSDestination("Entered_Date") = DTSSource("GN-DATE")
DTSDestination("Gen_Notes_ID") = tUniqueID
DTSDestination("From_DB") = tDatabaseNo
Main = DTSTransformStat_OK
End Function
The question is, should this be so slow ?, the reason I ask is that I run some tests without the lookup and it was much quicker, it even seemed much quicker doing an update of the two columns AFTER the insert.
Thanks for any advice
Dave