Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2004, 01:56 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Driven Query Update Row Problem

I am trying to compare two tables and update or insert the destination table based on a value in the source table. Below is the script I've setup in a data driven query task:

Function Main()
    DTSDestination("Comments") = DTSSource("Comment")
    DTSDestination("Zip") = DTSSource("Zip")
    DTSDestination("State") = DTSSource("State")
    DTSDestination("City") = DTSSource("City")
    DTSDestination("Address2") = DTSSource("Address2")
    DTSDestination("Address") = DTSSource("Address1")
    DTSDestination("PayorName") = DTSSource("Description")
    DTSDestination("PayorID") = DTSSource("ID")

Select Case DTSSource("UpdateKey")
    Case "I"
        Main = DTSTransformstat_InsertQuery
    Case "U"
        Main = DTSTransformstat_UpdateQuery
    Case Else
        Main = DTSTransformstat_SkipRow
End Select

End Function

PayorID and ID are the two respective primary keys.

The "I" or insert case works fine. However, if there is a "U" or Update row anywhere in the table, the script performs a Column Copy and every row is populate with the data of the last row with a "U" in the UpdateField.

What am I doing wrong?

 
Old June 10th, 2004, 08:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

sounds like your WHERE in the update isn't specific enough..

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Not getting Data Driven Subcription Option Mahesh N Raju Reporting Services 0 July 20th, 2007 06:06 AM
Update query problem Neal SQL Server 2000 1 April 18th, 2007 04:17 AM
Data Driven Query Task forkhead SQL Server DTS 1 June 22nd, 2006 11:01 AM
Data-Driven Subscription Markus27 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 May 12th, 2006 08:42 PM
Users selection driven search query... mat41 Classic ASP Databases 3 November 16th, 2004 03:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.