April 24, 2009 at 3:11 am
Hello All,
I am writing a sql query analyzer simulator/tool. I have a couple of stored procedures that will print status updates, using the SQL 'PRINT' statement. My code is written in java, and I use SimpleResultsets to process my results. Could anyone of you please give me some advice on how to get hold of the resulting output produced by the 'PRINT' statements in java? (maybe with the SimpleResultset or something similar?)
April 24, 2009 at 9:20 am
Not sure what you're wanting.
Is the problem that the print statements (status messages) aren't coming back until the procedure is finished? If so, replace the print statements with the RaisError statement, ie:
RaisError ('My status message', 10, 1) WITH NOWAIT
The severity level is low enough to be an informational message (not fail the procedure), while the NOWAIT sends it immediately to the client.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 4, 2009 at 1:44 am
Hello Everyone,
I posted this topic some time ago, and then got busy with something else...
I would like for my PRINT statements in my stored procedures to be written to an output file, for trouble shooting purposes should something go wrong.
Can anyone please give me an example or a link to an example of how this can be achieved?
Any help greatly appreciated!
Harriet
June 4, 2009 at 4:27 am
does anyone have any idea?;-)
June 4, 2009 at 6:39 am
Not sure how to do it in Java
But I would make the SP output a return value instead of print.
CREATE PROC p_ReturnValue
@ReturnValue INT output
AS
SET @ReturnValue = 999
RETURN @ReturnValue
declare @returnvalue int
execute p_ReturnValue @ReturnValue = @ReturnValue output
select TestReturn= @ReturnValue
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply