troubleshooting Question

Execute SQL task based on return value from stored procedure in DTS SQL Execute Task

Avatar of yami_rider
yami_rider asked on
Microsoft SQL Server
2 Comments1 Solution254 ViewsLast Modified:
Not very familure with DTS. However hopefully someone can at least get me started on the right track.

My problem here is I need to act upon a condition, specifically if a record exists in a table or not. So what I have done is the following:

* Created a stored procedure that simply checks for the existance of a record and returns a 1 for true or 0 for false.  This works as I use it in other code, but I am unsure exactly how to implement it in DTS (i.e. call it and get the return value).

* My DTS package needs to call this stored procedure, check the return value and execute either an UPDATE or an INSERT SQL statement into the table.  

My current code thus far works up to this point:

Step 1 DTS package reads in files from a local folder.
Step 2 DTS package will assign some global variables.
Step 3 DTS package will then create a temporary table and insert the records.

Step 4 [This is where I am stuck]
* Find a way to call my existing store procedure that will return 1 (true) or 0 (false).
* If true, update record
* If false, add record

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros