About 1,450,000 results
Open links in new tab
  1. SQL Server PRINT SELECT (Print a select query result)?

    Jan 1, 2010 · Of course, if you want to print all of the results from a query that returns multiple rows, you'd just direct your output appropriately (e.g. to Text). If you want to print multiple …

  2. SQL Server Cursor Explained By Examples - SQL Server Tutorial

    Then, fetch each row from the cursor and print out the product name and list price: FETCH NEXT FROM cursor_product INTO @product_name, @list_price; WHILE @@FETCH_STATUS = 0 …

  3. t sql - How to print a query from many rows in one line?

    Apr 15, 2019 · In SQL Server 2016 or higher, you can use STRING_AGG: (1, 3), --John link #2. (2, 2) -- Mike link #1. STRING_AGG(p.[Phone], ',') AS [Phone] Results: Find the answer to …

  4. SQL Server Cursor Example

    Apr 22, 2025 · Creating a SQL Server cursor with T-SQL is a consistent method that can process data on a set of rows. Once you learn the steps, you can easily duplicate them with various …

  5. SQL query to get multiple rows as output - Microsoft Q&A

    Jan 20, 2023 · It is able to filter data based on multiple criteria and arrange them in combination as required. But the data it outputs will still be confined to the grid, constrained by rows and …

  6. Return multiple rows from a cursor with just one fetch - SQLServerCentral

    Mar 17, 2004 · 1 (and maybe best): If you only need to retrieve 240 rows, do this in one single SELECT....into an array of your front end app. It then is a very easy exercise for any …

  7. sql - Print multiple rows from select statement - Stack Overflow

    Oct 8, 2017 · I want to print every rows in column C in T table which respect the pattern associated. This is what I did (Updated with the correct answer): v_patt …

  8. Master SQL Server Cursors with Free Training - Steve Stedman

    Apr 23, 2013 · Step 1: Declare variables to hold the output from the cursor. Step 2: Declare the cursor object; Step 3: Assign the query to the cursor. Step 4: Open the cursor. Step 5: Fetch …

  9. SQL Server Cursors: A How-To Guide - Simple SQL Tutorials

    Jun 9, 2021 · We use a cursor when we need to basically loop through the results of a query, from top to bottom, looking at each row and possibly doing some kind of work on the data. There …

  10. Using Cursor to loop through a Table variable in SQL Server

    Mar 27, 2019 · DECLARE @myTableVariable TABLE (id INT) insert into @myTableVariable values(1),(2),(3) declare @id INT = 0; DECLARE cur CURSOR FOR SELECT id FROM …

  11. Some results have been removed
Refresh