We help IT Professionals succeed at work.
Get Started

Looping

71 Views
Last Modified: 2020-02-11
Hi Guys

I have a MS SQL table called Scoreboard, it currently has 9 rows. See below

Snip20200205_19.png
I put together a query that reads from the table Scoreboard, see below. I want to run this query 9 times until it has read all 9 rows. How do I do this?

DECLARE @LeaderboardName		varchar		(20)
DECLARE @LeaderboardNameFull	varchar		(20) 
DECLARE @PlayerCount			varchar		(20)
DECLARE @PlayerName				varchar		(20)
DECLARE @Score					nvarchar	(20)
DECLARE @ZombiesKilled			varchar		(15)
DECLARE @Accuracy				varchar		(50)
DECLARE @DamageTaken			varchar		(20)
DECLARE @Deaths					varchar		(50)

Select	 @LeaderboardName        = LeaderboardName		from #Temp		
Select   @LeaderboardNameFull	 = LeaderboardNameFull	from #Temp		
Select   @PlayerCount	 = PlayerCount					from #Temp		
Select	 @PlayerName	 = PlayerName					from #Temp		
Select	 @Score	         = Score						from #Temp			
Select	 @ZombiesKilled	 = ZombiesKilled				from #Temp		
Select   @Accuracy	     = Accuracy						from #Temp				
Select	 @DamageTaken	 = DamageTaken					from #Temp		
Select  @Deaths			 = Deaths						from #Temp			


EXEC [Freak_APITest2]  @LeaderboardName, @LeaderboardNameFull,@PlayerCount, @PlayerName, @Score,@ZombiesKilled,@Accuracy,@DamageTaken,@Deaths

Open in new window


Any help is greatly appreciated.
Comment
Watch Question
Senior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE