Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:15:38+00:00 2026-06-15T11:15:38+00:00

I have a requirement to execute a query 6 times, but each time with

  • 0

I have a requirement to execute a query 6 times, but each time with a different parameter, is there any way i can execute it in some form of a loop. or do i have to execute it 6 times seperately ? i tried searching the web for answers, but i couldn’t find anything relevant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:15:39+00:00Added an answer on June 15, 2026 at 11:15 am
    declare @idx int = 0
    
    declare @parameter1 varchar(10) = 'foo'
    declare @parameter2 varchar(10) = 'bar'
    declare @parameter3 varchar(10) = 'sql'
    declare @parameter4 varchar(10) = 'star'
    declare @parameter5 varchar(10) = 'maa'
    declare @parameter6 varchar(10) = 'baa'
    
    while (@idx < 6)
    begin
        --example query using parameter based on loop counter
        select case 
            when @idx = 0 then @parameter1
            when @idx = 1 then @parameter2
            when @idx = 2 then @parameter3
            when @idx = 3 then @parameter4
            when @idx = 4 then @parameter5
            when @idx = 5 then @parameter6
        end
        set @idx = @idx + 1
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have requirement where some times I would like to load children as well
I have requirement to get Facebook friends list with their images. How can I
For my ipad application i have requirement like this For each row in root
I am trying to execute the following query. I don't have 'CrewID' column so
I have the requirement for a web script to execute an exe file and
My requirement is I want to diff two database which can be any database
I faced with MySql query which takes too much CPU and time to execute
I have a requirement to send the results of a query in emails. I
I have a requirement to execute a perl script from a PL/SQL script. The
I have a requirement where in, I need to execute n tasks at certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.