Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DTS- Insert multiple records from one record

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-01 : 08:41:23
jeya writes "Hi,

I am trying to read one record and insert multiple records from the one record.
eg Leave Table has one record for Leave start on 01/01/01 and end 31/01/01.
I will need to read the above record and insert 31 records in another table.

I have attached the following DTS I have try to do, but it is only inserting the last record.

What am I doing wrong here? Is there any other way ?


Function Main()

Dim tmptrandate 'temp transaction date
Dim workcounter 'Number of working days
Dim workunit 'Average of working unit per working days

tmptrandate = DTSSource("leave_start_date")
'counting the number of working days for this leave transaction
workcounter = 0
workunit = 0

While tmptrandate<=DTSSource("leave_end_date")
If weekday(tmptrandate,1) <> 7 and weekday(tmptrandate) <> 1 Then
workcounter = workcounter + 1 'incrementing counter per weekday
End if
tmptrandate=tmptrandate + 1 'incrementing the date
Wend

Thanks,
Jeya."
   

- Advertisement -