Re: Returning intermediate results from a stored procedure

From: Brian (bcap_at_IHATESPAMclara.co.uk)
Date: 02/24/05


Date: Thu, 24 Feb 2005 19:01:57 -0000


"Carl Imthurn" <nospam@all.com> wrote in message
news:eT7oKJpGFHA.2924@TK2MSFTNGP15.phx.gbl...
> Hi guys --
>
> A couple of things:
>
> 1) In regards to Tibor's suggestion:
>
> Theoretically, you can add RAISERROR command in between and use the
> NOWAIT option to the RAISERROR command. This means that SQL Server
> flushes the output buffer so the data in the buffer so far is sent to
> the client. In order to take advantage of this in the client
> applications, you need to program asynchronously (obviously, otherwise
> the call to the db API function is just sitting there until the whole
> procedure has executed). Try below from QA and you'll see the difference:
>
> I executed those commands again in QA and this time I got the expected
results:
>
> PRINT 'hello'
> WAITFOR DELAY '00:00:7'
> PRINT 'There'
>
> the above code printed 'hello' and 'There' at the same time; after 7
seconds.
> the following code printed 'hello' immediately and 'There' after 7
seconds.
>
> RAISERROR ('hello', 10, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:7'
> PRINT 'There'
>
> So, no idea what happened the first time on my end, but now I understand
what you mean.
> Sorry about the mixup on my end.
>
> 2) In regards to Brian's message:
>
> >> You haven't said what technology you are using
> >> (ADO.Net, ADO, DAO or whatever) but it shouldn't be hard to figure out
how
> >> to run a command or query asynchronously.
>
> I'm using ADO. Here's the relevant code:
>
> Dim Cmd As ADODB.Command
> Set Cmd = New ADODB.Command
> Cmd.CommandText = "si_Import_APTMST_FromAS400"
> Cmd.CommandType = adCmdStoredProc
> Cmd.ActiveConnection = pADOConnection ' already created earlier in
code
> Cmd.Execute
> Set Cmd = Nothing
>
> How do I execute this asynchronously? If you could steer me in the right
direction (a web
> page describing asynchronous execution, a newsgroup posting, etc.) I would
be in your debt.
>
> Thanks to both of you again for your time and expertise.
> PS I looked at the timestamp of your postings and thought goodness
gracious, don't these
> guys ever sleep? But from Brian's e-mail address he appears to be in the
UK, and if I
> remember correctly Tibor, you're in Sweden right now. Anyway, guys, thanks
a lot.
>
> Carl
>

Hi Carl,

I'm no ADO expert (by the time I thought about moving on from DAO, dotnet
was on it's way so there didn't seem much point in learning ADO!)

However, I understand that a command is executed asynchronously by
specifying the adAsyncExecute option for the Execute method. The command
object will raise an ExecuteComplete event when it's done.



Relevant Pages

  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)
  • Re: Returning intermediate results from a stored procedure
    ... "Carl Imthurn" wrote in message ... you can add RAISERROR command in between and use the ... > NOWAIT option to the RAISERROR command. ... specifying the adAsyncExecute option for the Execute method. ...
    (microsoft.public.sqlserver.programming)
  • Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
    (Bugtraq)
  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)
  • Execute Process Task not failing, but not executing the batch comm
    ... I can execute the following command from the windows "Run" prompt and it ... Might I have something set weird in SQL Server? ... server being by default configured to run as localsystem account, ...
    (microsoft.public.sqlserver.dts)

Loading