dbTalk Databases Forums  

LookUp Problem, I think.

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


Discuss LookUp Problem, I think. in the microsoft.public.sqlserver.dts forum.



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

Default LookUp Problem, I think. - 07-03-2006 , 04:28 AM






Hey guys,

I am very new, ie 1 hour so far, to DTS.

I have succeeded in creating a DTS thing which takes a csv file of
projects and imports it all into a temporary table in SQL Server.

What I wish to do, for say the Client column, is cycle through all the
rows and check if there is a client record in the db already and if so
insert the id value for this client. If there is not a client, I would
like to insert a new row into the client table and insert the id.

Can anyone help with this simple task?

Stuart


Reply With Quote
  #2  
Old   
StuartGMilton
 
Posts: n/a

Default Re: LookUp Problem, I think. - 07-03-2006 , 05:49 AM






Guys,

I have found where I think I will do this, there is code like the
following;

Function Main()


DTSDestination("BidNumber") = DTSSource("BidNumber")
DTSDestination("Client") = DTSSource("Client")
DTSDestination("Project") = DTSSource("Project")
DTSDestination("JobStatus") = DTSSource("JobStatus")
DTSDestination("BiddingOffice") = DTSSource("BiddingOffice")
DTSDestination("ProductType") = DTSSource("ProductType")
DTSDestination("Priority") = DTSSource("Priority")
DTSDestination("JobType") = DTSSource("JobType")
DTSDestination("ITTDueDate") = DTSSource("ITTDueDate")
DTSDestination("AwardDate") = DTSSource("AwardDate")
DTSDestination("WorkStartDate") = DTSSource("WorkStartDate")
DTSDestination("Go(%)") = DTSSource("Go(%)")
DTSDestination("Get(%)") = DTSSource("Get(%)")
DTSDestination("PursuitLeader") = DTSSource("PursuitLeader")
DTSDestination("ProposalEngineer") = DTSSource("ProposalEngineer")
DTSDestination("ProjectLocation") = DTSSource("ProjectLocation")
DTSDestination("BusinessLine") = DTSSource("BusinessLine")
Main = DTSTransformStat_OK
End Function

How do I search another table to see if the other table contains the
value in DTSSource???


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

Default Re: LookUp Problem, I think. - 07-04-2006 , 01:49 PM



Hello StuartGMilton,

You could of course use Lookups but this over a large input recordset will
be painful.

What I would do is import the file to a working table first and then use
TSQL to do the comparisons and actions based on the comparison.

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
Guys,

I have found where I think I will do this, there is code like the
following;

Function Main()

DTSDestination("BidNumber") = DTSSource("BidNumber")
DTSDestination("Client") = DTSSource("Client")
DTSDestination("Project") = DTSSource("Project")
DTSDestination("JobStatus") = DTSSource("JobStatus")
DTSDestination("BiddingOffice") = DTSSource("BiddingOffice")
DTSDestination("ProductType") = DTSSource("ProductType")
DTSDestination("Priority") = DTSSource("Priority")
DTSDestination("JobType") = DTSSource("JobType")
DTSDestination("ITTDueDate") = DTSSource("ITTDueDate")
DTSDestination("AwardDate") = DTSSource("AwardDate")
DTSDestination("WorkStartDate") = DTSSource("WorkStartDate")
DTSDestination("Go(%)") = DTSSource("Go(%)")
DTSDestination("Get(%)") = DTSSource("Get(%)")
DTSDestination("PursuitLeader") = DTSSource("PursuitLeader")
DTSDestination("ProposalEngineer") = DTSSource("ProposalEngineer")
DTSDestination("ProjectLocation") = DTSSource("ProjectLocation")
DTSDestination("BusinessLine") = DTSSource("BusinessLine")
Main = DTSTransformStat_OK
End Function
How do I search another table to see if the other table contains the
value in DTSSource???




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.