About 10,800,000 results
Open links in new tab
  1. Syntax of for-loop in SQL Server - Stack Overflow

    May 20, 2011 · SQL is a very different language compared to what you're used to. It's focused on what, not how. You tell SQL Server what results you want, and let it figure out how to produce …

  2. 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 …

  3. SQL Server FOR EACH Loop - Stack Overflow

    Jan 1, 2010 · SQL Server FOR EACH Loop Asked 13 years, 7 months ago Modified 6 years, 8 months ago Viewed 669k times

  4. 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 …

  5. How can INSERT INTO a table 300 times within a loop in SQL?

    In SQL, you should generally try to write set-based code, not procedural, step by step code. So, the SQLish thing to ask for is "how do I insert 300 rows into my table, where each row gets a …

  6. t sql - How to write a foreach in SQL Server? - Stack Overflow

    In most cases, you want to use a set-based solution, since that is how SQL Server is optimized to work. Looping and treating one row at a time certainly has its place, but I suspect this isn't it.

  7. sql - While Loop to Iterate through Databases - Stack Overflow

    I was wondering if someone could help me with creating a while loop to iterate through several databases to obtain data from one table from two columns. this is was I have done so far. …

  8. SQL Server - stop or break execution of a SQL script

    Mar 19, 2009 · Is there a way to immediately stop execution of a SQL script in SQL server, like a "break" or "exit" command? I have a script that does some validation and lookups before it …

  9. sql - Loop through all the rows of a temp table and call a stored ...

    Now i need to loop through the rows in the @temp table and and for each row call a sp that takes all the parameters of @temp table as input. How can I achieve this?

  10. In SQL Server, how to create while loop in select

    Nov 10, 2013 · In SQL Server, how to create while loop in select Asked 12 years ago Modified 9 years, 3 months ago Viewed 284k times