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 in Database by Kithuzzz
• 12,240 points
50 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 in Database by Kithuzzz
• 12,240 points
26 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 in Database by Kithuzzz
• 12,240 points
45 views
0 votes
0 answers

Search text in stored procedure in SQL Server

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

Aug 27 in Database by Kithuzzz
• 12,240 points
16 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 in Database by narikkadan
• 20,880 points
41 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 in Database by Neha
• 8,920 points
114 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,380 points
650 views
0 votes
1 answer

What is a stored procedure?

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

answered Feb 4 in Database by Neha
• 8,920 points
216 views
0 votes
1 answer

Function vs. Stored Procedure in SQL Server

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

answered Feb 17 in Database by Neha
• 8,920 points

edited Feb 17 by Neha 460 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 in Others by avinash
• 1,840 points
36 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 in Database by Vaani
• 7,020 points
121 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