About 5,470,000 results
Open links in new tab
  1. What is the use of a cursor in SQL Server? - Stack Overflow

    Sep 25, 2018 · Cursor might used for retrieving data row by row basis.its act like a looping statement (ie while or for loop). To use cursors in SQL procedures, you need to do the following: 1.Declare a …

  2. Using a cursor with dynamic SQL in a stored procedure

    A cursor will only accept a select statement, so if the SQL really needs to be dynamic make the declare cursor part of the statement you are executing. For the below to work your server will have to be …

  3. sql - What are the benefits of using database cursor? - Stack Overflow

    Oct 5, 2010 · Using a cursor it is possible to read sequentially through a set of data, programmatically, so it behaves in a similar manner to conventional file access, rather than the set-based behaviour …

  4. How to put parameterized sql query into variable and then execute in ...

    Apr 25, 2014 · I understand that the correct way to format a sql query in Python is like this: cursor.execute ("INSERT INTO table VALUES (%s, %s, %s)", var1, var2, var3) so that it prevents sql …

  5. Get Multiple Values in SQL Server Cursor - Stack Overflow

    Get Multiple Values in SQL Server Cursor Asked 14 years, 10 months ago Modified 3 years, 11 months ago Viewed 157k times

  6. sql server - Can I reset cursor's position to the beginning? - Stack ...

    Jun 26, 2013 · STATIC Defines a cursor that makes a temporary copy of the data to be used by the cursor. All requests to the cursor are answered from this temporary table in tempdb; therefore, …

  7. Why is it considered bad practice to use cursors in SQL Server?

    Dec 22, 2021 · Which is best? Hardcoding the SQL to do what I need to? Or iterate through this resultset and use dynamic-SQL (sp_executesql) to perform the operations? There is no way to …

  8. How can I run just the statement my cursor is on in SQL Server ...

    In SQL Server Management Studio, hitting F5 runs the entire script. To run just the current statement, I have to manually highlight the statement I want, and then hit F5.

  9. sql server - SQL cursor fetch status meaning - Stack Overflow

    Oct 7, 2015 · On a side note, MSDN also notes that is is a legacy thing, @@FETCH_STATUS is global, and therefore where multiple cursors are being used it is not to be trusted. Instead lookup your …

  10. sql - Using a cursor with a CTE - Stack Overflow

    Jan 30, 2013 · I need a cursor for the below query so I can loop through to fetch/update/insert some other data. Can somebody help me with this? DECLARE @FROMDATE DATETIME DECLARE …