Avatar of James Murphy
James MurphyFlag for Australia

asked on 

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

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!
SQLMicrosoft SQL Server* SQL SERVER 2017

Avatar of undefined
Last Comment
Andrei Fomitchev
ASKER CERTIFIED SOLUTION
Avatar of Andrei Fomitchev
Andrei Fomitchev
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo