Loop in stored procedure in SQL server

0 votes

Writing a stored procedure that calls another stored procedure and provides values to it is something I need assistance with. To transfer this from C# to a stored procedure and create a SQL agent task that calls the stored procedure at a certain time is what I want to do now. Any thoughts? This holds true.

Table A:

PK_TableA_ID

Table B:

PK_TableB_ID

Stored procedure SP1:

@TableA_ID
@TableB_ID

I need this but in T-SQL

foreach(var TableAId in TableA)
{
foreach(var TableBId in TableB)
{
//call stored procedure 
SP1(TableAId, TableBId);
}
}

Can someone please help me with this?

Aug 28, 2022 in Database by Kithuzzz
• 38,000 points
1,761 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
0 answers

If else in stored procedure sql server

I have created a stored procedure as ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,000 points
1,004 views
0 votes
0 answers

What is the syntax to drop a Stored Procedure in SQL Server 2000?

In SQL Server 2000, how do you ...READ MORE

Aug 25, 2022 in Database by Kithuzzz
• 38,000 points
609 views
0 votes
0 answers

Search text in stored procedure in SQL Server

I want to search all of my ...READ MORE

Aug 27, 2022 in Database by Kithuzzz
• 38,000 points
2,800 views
0 votes
1 answer

How to Execute SQL Server Stored Procedure in SQL Developer?

You don't need EXEC clause. Simply use: proc_name ...READ MORE

answered Sep 16, 2022 in Database by narikkadan
• 63,600 points
2,129 views
0 votes
1 answer

Syntax of for-loop in SQL Server

TSQL has no for-loop, we have only ...READ MORE

answered Feb 15, 2022 in Database by Neha
• 9,020 points
929 views
0 votes
1 answer

What are the different authentication modes in SQL Server? How can it be changed?

Windows mode and Mixed Mode – SQL ...READ MORE

answered Oct 29, 2018 in Database by Sahiti
• 6,370 points
1,225 views
0 votes
1 answer

What is a stored procedure?

A stored procedure is a set of ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
1,070 views
0 votes
1 answer

Function vs. Stored Procedure in SQL Server

Functions are calculated values that cannot make ...READ MORE

answered Feb 17, 2022 in Database by Neha
• 9,020 points

edited Feb 17, 2022 by Neha 19,328 views
0 votes
0 answers

What is a stored procedure?

119 What is a "stored procedure" , how do they work? What ...READ MORE

May 27, 2022 in Others by avinash
• 1,840 points
655 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3, 2022 in Database by Vaani
• 7,070 points
832 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP