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)
 Insert or Update database from text file

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-04 : 15:12:55
Gordon writes "I am using DTS from the Enterprise Manager.

I am using a Data Driven Query, and I want to process each record on the text file and either update an existing row or create a new row.

I have been trying to use an activex script behind the Transformation tab to return DTSTransformstat_UpdateQuery or DTSTransformstat_InsertQuery. This in turn will be picked up by the Query tab wihich will run an update or insert.

I am having trouble in the activex script, connecting to the database to run the select and then testing to see if a row is on the database.

Function Main()
dim scmd
dim status_flag

scmd = "select dim_product_id from [dbo].[date_table] where dim_product_id = "
scmd = scmd + DTSSource("Col002")
status_flag = exec(scmd)

if status_flag <> 0 then
Main = DTSTransformstat_UpdateQuery
else
Main = DTSTransformstat_InsertQuery
end if
End Function


Hoping you can help"

kjbalaji
Starting Member

1 Post

Posted - 2001-12-07 : 00:26:02
I too want this.
Can u help in this regard


quote:

Gordon writes "I am using DTS from the Enterprise Manager.

I am using a Data Driven Query, and I want to process each record on the text file and either update an existing row or create a new row.

I have been trying to use an activex script behind the Transformation tab to return DTSTransformstat_UpdateQuery or DTSTransformstat_InsertQuery. This in turn will be picked up by the Query tab wihich will run an update or insert.

I am having trouble in the activex script, connecting to the database to run the select and then testing to see if a row is on the database.

Function Main()
dim scmd
dim status_flag

scmd = "select dim_product_id from [dbo].[date_table] where dim_product_id = "
scmd = scmd + DTSSource("Col002")
status_flag = exec(scmd)

if status_flag <> 0 then
Main = DTSTransformstat_UpdateQuery
else
Main = DTSTransformstat_InsertQuery
end if
End Function


Hoping you can help"



Go to Top of Page
   

- Advertisement -