troubleshooting Question

How to run stored procedure based on query from cte, until all rows have been submited in Stored Procedure

Avatar of James Murphy
James MurphyFlag for Australia asked on
SQLMicrosoft SQL Server* SQL SERVER 2017
1 Comment1 Solution13 ViewsLast Modified:
Hi,
Firstly thank you for taking a look at my question!

Basically I have an API I need to upload data to.

Normally fairly easy, but in this instance, I need to do separate submissions based on a common field value.
for example, say I have 4 rows in a cte called "CTE_Campaign"

FileNo       Name            INTNUM
1                TEST 1          4
2                TEST 2          3
3                Test 3             4
4                Test 4              1

so using the above data, in theory there would be 3 different submissions
Campaign 1 - Intnum4
FileNo       Name            INTNUM
1                TEST 1          4
3                Test 3             4

Campaign 2 - Intnum3
FileNo       Name            INTNUM
2                TEST 2          3

Campaign 3 - Intnum1
FileNo       Name            INTNUM
4                Test 4              1

It actually helped writing it out here to make it clearer as to what I need to do, but could someone give me a bit of guidance as to how to proceed with this?

many thanks!
ASKER CERTIFIED SOLUTION
Andrei Fomitchev
Sr. DBA

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
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 1 Comment.
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