About 50 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. t sql - SQL Server - Cursor - Stack Overflow

    Jan 20, 2012 · Or even better, don't use a cursor (this can be performed as a select, but I leave this up to you... Just wanted to show how to use a cursor AND a table as return value)

  4. sql - Cursor inside cursor - Stack Overflow

    One more question: what version of sql server, because that will determine what we can use for creating the row numbers to replace your @counter in the inner cursor.

  5. How to use cursor within cursor in SQL Server? - Stack Overflow

    Jan 18, 2017 · I have the following query, I want use a nested cursor in my query. How to do this, because it's not running and I am new to SQL Server. Please help me CHECK TABLE SUGGEST …

  6. sql - How to use cursor to update record - Stack Overflow

    Dec 28, 2011 · i am using below query to update my all records but it starts update from second row how can i modify it to do changes from 1'st row ? i am using mssql 2008 i think i can not use …

  7. sql server - If-Else Condition inside cursor - Stack Overflow

    Mar 13, 2017 · My Current SQL Syntax is something like Declare CursorName CURSOR FOR Select Query Now the select query would contain an If-Else Condition. If @Parameter1 is NULL BEGIN …

  8. sql server - Select statement in cursor - Stack Overflow

    0 Try and avoid Cursors. As for your question, Yes it will work but you will end-up with multiple result-sets. Declare a Table Variable and insert into that table variable and select from the table variable …

  9. sql - How to update a column fetched by a cursor in TSQL - Stack …

    Nov 3, 2016 · In this particular case I'm running a cursor on a temporary table of 100 or so records, and that temporary table will always be fairly small, so performance is less crucial than flexibility. My …

  10. sql server - How do I select multiple columns in a cursor ... - Stack ...

    Apr 12, 2022 · You select the actual columns in the query that defines the cursor, You then fetch those values into variables. There is an example in the documentation. Your FETCH is correct - the actual …