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
 Import/Export (DTS) and Replication (2000)
 DTS Package Can't update table with Lookup Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-31 : 07:37:40
gidgit writes "I am trying to create a dts package that will update the data in an MS Access table from the sql server db.
I am using Lookup queries: GetModelID which looks through the Access table to find a match. If there is no match it will insert the new record (this works fine).
If there is a match, it is to update the record with the current information using the update lookup query (UpdateModel).
However when this part runs, I get the error: "The number of failing rows exceeds the maximum specified. Index or Primary key can not contain a Null value"

Function Main()
if IsEmpty( DTSLookups("GetModelID").Execute(DTSSource("plan_id_"))) then
'append new data
DTSDestination("modelID") = DTSSource("plan_id_")
DTSDestination("modelName") = DTSSource("name_")
DTSDestination("activePrice") = DTSSource("active_price_")
DTSDestination("availableSale") = DTSSource("available_sale_")
else
'update old data
DTSLookups("UpdateModel").Execute DTSSource("name_"), DTSSource("available_sale_"), DTSSource("active_price_"),DTSSource("plan_id_")

End If
Main = DTSTransformStat_OK
End Function

Any help would be greatly appreciated."
   

- Advertisement -