About 121,000 results
Open links in new tab
  1. How do I loop through a set of records in SQL Server?

    224 How do I loop through a set of records from a select statement? Say I have a few records that I wish to loop through and do something with each record. Here's a primitive version of my select statement:

  2. sql server - Is there a way to loop through a table variable in TSQL ...

    declare @databases table ( DatabaseID int, Name varchar(15), Server varchar(15) ) -- insert a bunch rows into @databases Is declaring and using a cursor my only option if I wanted to iterate through …

  3. How do I Loop through a table and update a field in SQL

    Feb 18, 2017 · How do I Loop through a table and update a field in SQL Ask Question Asked 8 years, 9 months ago Modified 8 years, 9 months ago

  4. sql loop through each row in a table - Stack Overflow

    Can't really picture what you're after, but to answer the question in your subject line, you loop through the rows in a table with a CURSOR.

  5. How can I loop through all rows of a table? (MySQL)

    Since the suggestion of a loop implies the request for a procedure type solution. Here is mine. Any query which works on any single record taken from a table can be wrapped in a procedure to make it run …

  6. SQL - Iterating through table records - Stack Overflow

    May 17, 2013 · ID -- 1 2 3 4 In reality, I want to iterate through each of the rows in this table. However, I cannot figure out how to do this. Can someone show me some sample SQL ...

  7. sql - How to iterate over results of query - Stack Overflow

    I am creating a function in pgsql script language, and what I want to do in this point is iterate over the results of a query and for each row do something specific. My current try is the following,

  8. sql - How do I execute a stored procedure once for each row returned …

    Apr 6, 2016 · Chances are that you don't need a stored procedure at all. Can you outline "what" the stored procedure does, exactly? Maybe the whole process can be expressed as a single update …

  9. sql server - T-SQL - What's the most efficient way to loop through a ...

    May 28, 2018 · T-SQL - What's the most efficient way to loop through a table until a condition is met Ask Question Asked 7 years, 6 months ago Modified 7 years, 6 months ago

  10. Loop through a recordset and use the result to do another SQL select ...

    Mar 8, 2013 · Then loop through this record set. Let's say I pass in SomeID = 35. So, the record set will return 2 records with SomeID 35. In the loop, I will get ProductID 8 and 11, which will be used to do …