About 70,700 results
Open links in new tab
  1. Do while loop in SQL Server 2008 - Stack Overflow

    Dec 20, 2010 · Is there any method for implement do while loop in SQL server 2008?

  2. How do I loop through a set of records in SQL Server?

    Cursors are more verbose than while statements, but they're more optimized. I wouldn't recommend a while statement, especially with a subquery in the loop condition.

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

    You don't state why you want to avoid a cursor. Be aware that a cursor might be the simplest way to iterate. You may have heard that cursors are 'bad', but it is really iteration over tables that is …

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

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

  5. While loop with multiple conditions in T-SQL - Stack Overflow

    Let me start out by saying I know I KNOW that these kind of loops are horrible and you shouldn't use them in Transact SQL. But, for some purposes (those purposes being irrelevant so don't …

  6. t sql - How to use while loop to iterate through each table name …

    Sep 29, 2020 · Here basically I want to make sure that the operations inside the while loop should occur for all the tables in the @tableName (defined above). I don't know how I can give this …

  7. T-SQL loop over query results - Stack Overflow

    Aug 7, 2012 · 98 I run a query select @id=table.id from table and I need to loop over the results so I can exec a store procedure for each row exec stored_proc …

  8. sql - create while loop with cte - Stack Overflow

    Oct 17, 2012 · how to create sql server cte from a while loop my loop like this declare @ind as int declare @code as nvarchar set @ind = 0 while @ind < 884 begin select @ind = @ind + 1 ...

  9. Can I loop through a table variable in T-SQL? - Stack Overflow

    0 Following Stored Procedure loop through the Table Variable and Prints it in Ascending ORDER. This example is using WHILE LOOP. CREATE PROCEDURE PrintSequenceSeries -- Add the …

  10. T-SQL Output Message During execution in SSMS - Stack Overflow

    Jun 16, 2016 · I have a simple query which loops and I want to see the PRINT messages during the execution. The query is something like this: WHILE 1 = 1 BEGIN WAITFOR DELAY …