Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Driven Query

Status
Not open for further replies.

swoodring

Programmer
Dec 7, 2000
114
US
I'm trying to use a data driven query. What I'm tyring to do is - I'm bringing in a file from the as/400 and populating the sql server with the data. I want to either update or write depending on whether it already exists. I've found a sample of a data driven query in a book but it uses a case statement. What I'd like to do is use an if statment instead. But when I try to use the if its giving me a syntex error. Here's the code I'm trying to use.

Function Main()
If DTSDestination("StoreNumber") =
DTSSource("DSRHSTR")And
DTSDestination("Controller") =
DTSSource("DSRHCTL") And
DTSDestination("Register#") =
DTSSource("DSRHREG") And
DTSDestination("Transaction#") =
DTSSource("DSRHTR#") And
DTSDestination("TransactionDate") = cdate(DTSSource("DSRHDATI")) & " " & timevalue(DTSSource("DSRHTIME"))
Then
DTSDestination("StoreIndex") = DTSSource("DSRHSTX")
DTSDestination("Controller") = DTSSource("DSRHCTL")
DTSDestination("Register#") = DTSSource("DSRHREG")
DTSDestination("Transaction#") = DTSSource("DSRHTT")
DTSDestination("TransactionDate") = cdate(DTSSource etc...
Main = DTSTransformstat_UpdateQuery

Else
DTSDestination("StoreIndex") = DTSSource("DSRHSTX")
DTSDestination("Controller") = DTSSource("DSRHCTL")
DTSDestination("Register#") = DTSSource("DSRHREG")
DTSDestination("Transaction#") = DTSSource("DSRHTT")
DTSDestination("TransactionDate") = cdate(DTSSource etc...
Main = DTSTransformstat_InsertQuery
Endif
End Function

Then after I have this working I woould go under the queries tab inthe data driven query and create the insert and update queries. But I can't seem to get this script to parse. Its getting the error on the if statment. All it gives me is syntax error. Not sure what the problem is. Any ideas?

Stacy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top