dbTalk Databases Forums  

Help needed with ActiveX script

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


Discuss Help needed with ActiveX script in the microsoft.public.sqlserver.dts forum.



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

Default Help needed with ActiveX script - 03-17-2005 , 09:55 AM






Hello

I hace creatre a dts package that uses an ActiveX script to either insert or
update existing records in an Oracle RDB database. The script fails on an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which works) to
verify a matching record in the output database(Oacle RDB). Please review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile
'************************************************* *********************
' Visual Basic Transformation Script
'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =
DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function





Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-17-2005 , 01:24 PM






Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote


Quote:
Hello

I hace creatre a dts package that uses an ActiveX script to either insert or
update existing records in an Oracle RDB database. The script fails on an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which works) to
verify a matching record in the output database(Oacle RDB). Please review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile
'************************************************* *********************
' Visual Basic Transformation Script
'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =
DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function


Reply With Quote
  #3  
Old   
Jim Wile
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-17-2005 , 02:07 PM



Hi Allen

No, I checked, there are no duplicate records in the input source, any other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote


Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which works) to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile
'************************************************* *********************
' Visual Basic Transformation Script

'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =
DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function




Reply With Quote
  #4  
Old   
Jim Wile
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-18-2005 , 07:03 AM



Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote

Quote:
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote


Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script

'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function






Reply With Quote
  #5  
Old   
Paul Smith
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 12:46 AM



Sholdnt the last Main = DTSTransformStat_OK be either
DTSTransFormstat_InsertQuery or DTSTransFormstat_UpdateQuery ?

Paul
"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote

Quote:
Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote


Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script

'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function








Reply With Quote
  #6  
Old   
Jim Wile
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 07:07 AM



Paul thanks for responding,

I commented out the last line (Main = DTSTransformStat_OK) and receive the
following error:
'DataDrivenQuery : Transformation status returned a DataDrivenQuery value,
but no DataDrivenQueries were specified'

This is my first ActiveX script and I am lost! any help would be greatly
appreciated.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote

Quote:
Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote


Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which
works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script


'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function








Reply With Quote
  #7  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 07:16 AM



This is in a DDQ (Data Driven Query Task) right?

If it is then have you defined the queries for the actions you want to take?

Itzik Ben-Gan has an excellent article on using the DDQ in SQL Server magazine.

Personally I would look to throw the rows over to oracle and into a stagin table. I would then use PLSQL to do the INSERT/UPDATE.
It is invariably much quicker.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote

Quote:
Paul thanks for responding,

I commented out the last line (Main = DTSTransformStat_OK) and receive the
following error:
'DataDrivenQuery : Transformation status returned a DataDrivenQuery value,
but no DataDrivenQueries were specified'

This is my first ActiveX script and I am lost! any help would be greatly
appreciated.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:OUgyxr7KFHA.3404 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:jimwile (AT) mopac (DOT) com:

Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which
works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script


'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") = DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function










Reply With Quote
  #8  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 07:18 AM



I, too, have an article with code:

http://msdn.microsoft.com/library/de...ml/sql00l5.asp

;-)

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
..
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

This is in a DDQ (Data Driven Query Task) right?

If it is then have you defined the queries for the actions you want to take?

Itzik Ben-Gan has an excellent article on using the DDQ in SQL Server
magazine.

Personally I would look to throw the rows over to oracle and into a stagin
table. I would then use PLSQL to do the INSERT/UPDATE.
It is invariably much quicker.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote

Quote:
Paul thanks for responding,

I commented out the last line (Main = DTSTransformStat_OK) and receive the
following error:
'DataDrivenQuery : Transformation status returned a DataDrivenQuery value,
but no DataDrivenQueries were specified'

This is my first ActiveX script and I am lost! any help would be greatly
appreciated.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:OUgyxr7KFHA.3404 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight
away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:jimwile (AT) mopac (DOT) com:

Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which
works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script


'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") =
DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function










Reply With Quote
  #9  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 07:24 AM



And Tom has an article also.....


Sorry Tom.

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote

Quote:
I, too, have an article with code:

http://msdn.microsoft.com/library/de...ml/sql00l5.asp

;-)

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
.
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:OOpFUWILFHA.1176 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
This is in a DDQ (Data Driven Query Task) right?

If it is then have you defined the queries for the actions you want to take?

Itzik Ben-Gan has an excellent article on using the DDQ in SQL Server
magazine.

Personally I would look to throw the rows over to oracle and into a stagin
table. I would then use PLSQL to do the INSERT/UPDATE.
It is invariably much quicker.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:%23E0RnSILFHA.568 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Paul thanks for responding,

I commented out the last line (Main = DTSTransformStat_OK) and receive the
following error:
'DataDrivenQuery : Transformation status returned a DataDrivenQuery value,
but no DataDrivenQueries were specified'

This is my first ActiveX script and I am lost! any help would be greatly
appreciated.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:OUgyxr7KFHA.3404 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there no one who can help me with this problem, I have been struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight
away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:jimwile (AT) mopac (DOT) com:

Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which
works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script


'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") =
DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function












Reply With Quote
  #10  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Help needed with ActiveX script - 03-19-2005 , 07:59 AM



;-)


--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
..
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

And Tom has an article also.....


Sorry Tom.

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote

Quote:
I, too, have an article with code:

http://msdn.microsoft.com/library/de...ml/sql00l5.asp

;-)

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
.
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:OOpFUWILFHA.1176 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
This is in a DDQ (Data Driven Query Task) right?

If it is then have you defined the queries for the actions you want to
take?

Itzik Ben-Gan has an excellent article on using the DDQ in SQL Server
magazine.

Personally I would look to throw the rows over to oracle and into a stagin
table. I would then use PLSQL to do the INSERT/UPDATE.
It is invariably much quicker.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:%23E0RnSILFHA.568 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Paul thanks for responding,

I commented out the last line (Main = DTSTransformStat_OK) and receive
the
following error:
'DataDrivenQuery : Transformation status returned a DataDrivenQuery
value,
but no DataDrivenQueries were specified'

This is my first ActiveX script and I am lost! any help would be greatly
appreciated.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:OUgyxr7KFHA.3404 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there no one who can help me with this problem, I have been
struggling
with it for days.

Thanks
Jim Wile


"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:usfZ7zyKFHA.1176 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Allen

No, I checked, there are no duplicate records in the input source, any
other
thoughts?

Thanks
Jim Wile


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eACc9YyKFHA.3064 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is it possible you have duplicates in the source?

Remember that these rows do not necessarily get inserted straight
away
either as the default I to commit the whole batch at once.



"Jim Wile" <jimwile (AT) mopac (DOT) com> wrote in message
news:jimwile (AT) mopac (DOT) com:

Hello

I hace creatre a dts package that uses an ActiveX script to either
insert or
update existing records in an Oracle RDB database. The script
fails
on
an
duplicate key value on the index on the vendor_number field. The
Vendor_number field is the field I am using in a lookup (which
works)
to
verify a matching record in the output database(Oacle RDB). Please
review
the following ActiveX script and advise me of any corrections.

Thanks

Jim Wile

'************************************************* *********************
' Visual Basic Transformation Script


'************************************************* ***********************

' Copy each source column to the destination column
Function Main()
DIM Lookup_Vendor
DIM InsertOrUpdate
stop
Lookup_Vendor =

DTSLookups("Lookup_existing").Execute(DTSSource("S HORT_VENDOR_NUMBER"))
If (IsEmpty(Lookup_Vendor)) Then
Main = DTSTransFormstat_InsertQuery
MSGBOX ("insert " & Lookup_Vendor)
InsertOrUpdate = "Insert"
Else
Main = DTSTransFormstat_UpdateQuery
MSGBOX ("update " & Lookup_Vendor)
InsertOrUpdate = "Update"
End If
If (InsertOrUpdate = "Insert") Then
DTSDestination("VENDOR_NUMBER") =
DTSSource("SHORT_VENDOR_NUMBER")
End If
DTSDestination("VENDOR_NAME") = DTSSource("VENDOR_NAME")
DTSDestination("ADDRESS_1") = DTSSource("SYS_ADDRESS_1")
DTSDestination("ADDRESS_2") = DTSSource("SYS_ADDRESS_2")
DTSDestination("CITY") = DTSSource("SYS_CITY")
DTSDestination("STATE") = DTSSource("SYS_STATE")
DTSDestination("ZIP_CODE") = DTSSource("SYS_POSTAL_CODE")
DTSDestination("PHONE_NUMBER") = DTSSource("PHONE")
DTSDestination("ADDRESS_3") = DTSSource("SYS_ADDRESS_3")
DTSDestination("VENDOR_TYPE") = ("XX")
DTSDestination("TAGS_ON_BILLS") = ("N")
Main = DTSTransformStat_OK
End Function












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.