dbTalk Databases Forums  

Multiple Destination table

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Multiple Destination table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Krish
 
Posts: n/a

Default Multiple Destination table - 09-14-2004 , 10:25 AM






Iam a newbie...i'll really appreciate if somebody can provide a solution
with code examples...

I have a situation like this...
I get my data in a text files (tab delimited) an then using DTS I need to
populate a SQL server 2000 database.
The question is: How can I split a source row of data and load multiple
destination tables in the same step?
For instance if the source row has information like this...
6/7/2004|999-99-9999|FirstName|LastName|MiddleName|Address|English |PASS|Math
Quote:
Fail
I need to insert above info into two tables
Correspondence & Score
Table correspondence
id_corr
SSN
First Name
Last Name
Middle Name
Address

Table Score
id_Corr
subject
result

Please note id_corr is primary key for table correspondence and foreign key
for score table.

I have my dts transform data task activex script like this

DTSGlobalVariables("mIDCorr").value = maxIDCorr
DTSDestination("id_corr") = maxIDCorr
DTSDestination("ssn") = DTSSource("Col002")
.....

If DTSSource("Col010") = "PASS" Then
SQL = "Insert into km_stage_score (id_corr,subject,result) " & _
" values ('" & maxIDCorr & " ',' " & DTSSource("Col012") & " ',' " &
DTSsource ("Col011") & "' "
Conn.Execute SQL
End If

The problem is ...Insert sql does not work..if i remove this DTS runs
without any error. Please help.

Krish







Reply With Quote
  #2  
Old   
Krish
 
Posts: n/a

Default Re: Multiple Destination table - 09-14-2004 , 11:58 AM






i figured it out......... i used datapump

Krish

"Krish" <NOspam (AT) Nospam (DOT) org> wrote

Quote:
Iam a newbie...i'll really appreciate if somebody can provide a solution
with code examples...

I have a situation like this...
I get my data in a text files (tab delimited) an then using DTS I need to
populate a SQL server 2000 database.
The question is: How can I split a source row of data and load multiple
destination tables in the same step?
For instance if the source row has information like this...

6/7/2004|999-99-9999|FirstName|LastName|MiddleName|Address|English |PASS|Math
|Fail

I need to insert above info into two tables
Correspondence & Score
Table correspondence
id_corr
SSN
First Name
Last Name
Middle Name
Address

Table Score
id_Corr
subject
result

Please note id_corr is primary key for table correspondence and foreign
key
for score table.

I have my dts transform data task activex script like this

DTSGlobalVariables("mIDCorr").value = maxIDCorr
DTSDestination("id_corr") = maxIDCorr
DTSDestination("ssn") = DTSSource("Col002")
....

If DTSSource("Col010") = "PASS" Then
SQL = "Insert into km_stage_score (id_corr,subject,result) " & _
" values ('" & maxIDCorr & " ',' " & DTSSource("Col012") & " ',' "
&
DTSsource ("Col011") & "' "
Conn.Execute SQL
End If

The problem is ...Insert sql does not work..if i remove this DTS runs
without any error. Please help.

Krish








Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.