﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Cursor.. cmds don’t seem to update until everything has finished / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 20:33:01 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Cursor.. cmds don’t seem to update until everything has finished</title><link>http://www.sqlservercentral.com/Forums/Topic1427345-338-1.aspx</link><description>Maybe an even better approach would be to remove the cursor and do your inserts set based? Cursors are notoriously slow and over used. They have their place but very rarely does doing some inserts like you are describing require a cursor.</description><pubDate>Wed, 06 Mar 2013 07:44:28 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: Cursor.. cmds don’t seem to update until everything has finished</title><link>http://www.sqlservercentral.com/Forums/Topic1427345-338-1.aspx</link><description>inside a cursor, that's normal; what you want to do instead of [b]print [/b]is raise a low level error inside via [b]RAISERROR  [/b]the cursor so you can see things as it happens. errors with NOWAIT are immediately visible in the results pane.example:[code]--print error immediately in batchdeclare @i int,        @err varchar(100)--set @i=1while 0=0beginSET @err = 'Progress So Far: Step ' + convert(varchar(30),ISNULL(@i,1)) + ' completed.'raiserror (@err,0,1) with nowaitwaitfor delay '00:00:02'set @i=ISNULL(@i,1) + 1end[/code]</description><pubDate>Wed, 06 Mar 2013 06:46:35 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Cursor.. cmds don’t seem to update until everything has finished</title><link>http://www.sqlservercentral.com/Forums/Topic1427345-338-1.aspx</link><description>Try using this instead of print, which is buffered:raiserror ('My Print Statement', 10,1) with nowaitYour inserts may be uncommitted until the cursor loop has completed, in which case you could still see some data using the NOLOCK query hint.</description><pubDate>Wed, 06 Mar 2013 06:41:56 GMT</pubDate><dc:creator>ChrisM@Work</dc:creator></item><item><title>Cursor.. cmds don’t seem to update until everything has finished</title><link>http://www.sqlservercentral.com/Forums/Topic1427345-338-1.aspx</link><description>I have a cursor and in that cursorI have a number of commands like[code="sql"]EXEC (@command)print 'ghgfhgfhgfh’insert mytable values (@aaaaa)[/code]I would expect that with each loop of the cursor I would see the results of the print statement and a value inserted into mytable.But I don’t it seems that the whole cursor has to be processed then all print statements appear and all the inserts occur all at once.I need to see how far and fast the cursor is processing, also I am worried that none of the memory is being freed up until the whole cursor has finishedAny help?Many thanks</description><pubDate>Wed, 06 Mar 2013 06:30:57 GMT</pubDate><dc:creator>Edward-445599</dc:creator></item></channel></rss>