How can I force the contents of Query Analyzer's buffer to display to the
 screen?
 A stored proc has some debug PRINT statements in it. The proc takes a long
 time to execute and the PRINT statements don't display until execution is
 complete.
 Is it possible to force them to display immediately? If so, how?How about RAISERROR WITH NOWAIT? Watch the messages pane:
PRINT 'foo'
WAITFOR DELAY '00:00:05'
GO
RAISERROR('foo', 11, 1) WITH NOWAIT
WAITFOR DELAY '00:00:05'
GO
http://www.aspfaq.com/
(Reverse address to reply.)
"Dave" <dave@.nospam.ru> wrote in message
news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a
long
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?
>|||Thanks Aaron
That works and it also prints out any unprinted PRINT statements previous to
the RAISERROR.
THe red error messages are a distraction but I can live with that.
Thank you.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > How can I force the contents of Query Analyzer's buffer to display to
the
> > screen?
> >
> > A stored proc has some debug PRINT statements in it. The proc takes a
> long
> > time to execute and the PRINT statements don't display until execution
is
> > complete.
> >
> > Is it possible to force them to display immediately? If so, how?
> >
> >
>|||Even better, use a severity of 10 or lower to emulate what PRINT does (i.e.,
no error condition raised)...
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > How can I force the contents of Query Analyzer's buffer to display to
the
> > screen?
> >
> > A stored proc has some debug PRINT statements in it. The proc takes a
> long
> > time to execute and the PRINT statements don't display until execution
is
> > complete.
> >
> > Is it possible to force them to display immediately? If so, how?
> >
> >
>|||Good point, just in the habit of using 11.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:egrs6xbHFHA.720@.TK2MSFTNGP10.phx.gbl...
> Even better, use a severity of 10 or lower to emulate what PRINT does
(i.e.,
> no error condition raised)...
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> > How about RAISERROR WITH NOWAIT? Watch the messages pane:
> >
> >
> > PRINT 'foo'
> > WAITFOR DELAY '00:00:05'
> > GO
> > RAISERROR('foo', 11, 1) WITH NOWAIT
> > WAITFOR DELAY '00:00:05'
> > GO
> >
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "Dave" <dave@.nospam.ru> wrote in message
> > news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > > How can I force the contents of Query Analyzer's buffer to display to
> the
> > > screen?
> > >
> > > A stored proc has some debug PRINT statements in it. The proc takes a
> > long
> > > time to execute and the PRINT statements don't display until execution
> is
> > > complete.
> > >
> > > Is it possible to force them to display immediately? If so, how?
> > >
> > >
> >
> >
>|||> THe red error messages are a distraction but I can live with that.
Just follow Adam's advice and lower the severity level.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Dave" <dave@.nospam.ru> wrote in message news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...
> Thanks Aaron
> That works and it also prints out any unprinted PRINT statements previous to
> the RAISERROR.
> THe red error messages are a distraction but I can live with that.
> Thank you.
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
>> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>>
>> PRINT 'foo'
>> WAITFOR DELAY '00:00:05'
>> GO
>> RAISERROR('foo', 11, 1) WITH NOWAIT
>> WAITFOR DELAY '00:00:05'
>> GO
>>
>> --
>> http://www.aspfaq.com/
>> (Reverse address to reply.)
>>
>>
>> "Dave" <dave@.nospam.ru> wrote in message
>> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
>> > How can I force the contents of Query Analyzer's buffer to display to
> the
>> > screen?
>> >
>> > A stored proc has some debug PRINT statements in it. The proc takes a
>> long
>> > time to execute and the PRINT statements don't display until execution
> is
>> > complete.
>> >
>> > Is it possible to force them to display immediately? If so, how?
>> >
>> >
>>
>|||Got it.
Thanks
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uj4f94bHFHA.3624@.tk2msftngp13.phx.gbl...
> > THe red error messages are a distraction but I can live with that.
> Just follow Adam's advice and lower the severity level.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "Dave" <dave@.nospam.ru> wrote in message
news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...
> > Thanks Aaron
> >
> > That works and it also prints out any unprinted PRINT statements
previous to
> > the RAISERROR.
> >
> > THe red error messages are a distraction but I can live with that.
> >
> > Thank you.
> >
> >
> > "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> > news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> >> How about RAISERROR WITH NOWAIT? Watch the messages pane:
> >>
> >>
> >> PRINT 'foo'
> >> WAITFOR DELAY '00:00:05'
> >> GO
> >> RAISERROR('foo', 11, 1) WITH NOWAIT
> >> WAITFOR DELAY '00:00:05'
> >> GO
> >>
> >>
> >> --
> >> http://www.aspfaq.com/
> >> (Reverse address to reply.)
> >>
> >>
> >>
> >>
> >> "Dave" <dave@.nospam.ru> wrote in message
> >> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> >> > How can I force the contents of Query Analyzer's buffer to display to
> > the
> >> > screen?
> >> >
> >> > A stored proc has some debug PRINT statements in it. The proc takes
a
> >> long
> >> > time to execute and the PRINT statements don't display until
execution
> > is
> >> > complete.
> >> >
> >> > Is it possible to force them to display immediately? If so, how?
> >> >
> >> >
> >>
> >>
> >
> >
>|||did you try using "results in text" instead of "results in grid"?
Dave wrote:
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a long
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?|||SQL Server doesn't send its output to the client immediately as it is generated by the engine. This
is to consume less network resources. And this is the reason why we don't see things like PRINT
immediately after they have been performed. SQL Server will wait until its output buffer is full, or
until the batch has ended. The trick with RAISERROR and NOWAIT is that it forces SQL Server to flush
the output buffer.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"ch" <ch@.dontemailme.com> wrote in message news:42237E8F.7DC18B52@.dontemailme.com...
> did you try using "results in text" instead of "results in grid"?
>
> Dave wrote:
>> How can I force the contents of Query Analyzer's buffer to display to the
>> screen?
>> A stored proc has some debug PRINT statements in it. The proc takes a long
>> time to execute and the PRINT statements don't display until execution is
>> complete.
>> Is it possible to force them to display immediately? If so, how?|||> The trick with RAISERROR and NOWAIT is that it forces SQL Server to flush
> the output buffer.
Right, this is why you usually see the PRINT and the RAISERROR come to the
messages pane at roughly the same time, even if the PRINT is issued before a
delay and the RAISERROR comes after.
--
http://www.aspfaq.com/
(Reverse address to reply.)
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment