Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vladimir_grigoro
Yak Posting Veteran
62 Posts |
Posted - 2002-11-01 : 06:33:21
|
| Dear All,I have such problem. If I have one stored procedure, where I want to return specific results after each batch. But the query analyzer return all results at the same time at the end of the execution. How could I solve this problem? I am using SQL Server 2000.Example:CREATE PROCEDURE ...ASINSERT ...SELECT 'INSERT OK' AS RESULT1UPDATE ...SELECT 'UPDATE OK' AS RESULT2abd etc.Thank you in advance.The RebelEdited by - vladimir_grigoro on 11/01/2002 06:34:38 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2002-11-01 : 07:43:28
|
| Method 1:DECLARE @RESULT1 VARCHAR (20), @RESULT2 VARCHAR (20)SELECT @RESULT1 = 'INSERT OK'SELECT @RESULT2 = 'UPDATE OK' .....SELECT @RESULT1 + @RESULT2RETURNMethod 2:CREATE PROCEDURE ABC @OutputResults VARCHAR (1000) OUTPUTASDECLARE @CR VARCHAR (1) -- CARRIAGE RETURN FOR FORMATTINGSET @CR = CHAR(10)SET @OutputResult = ''-- Some processingSET @OutputResult = @OutputResult + 'Insert OK ' + @CR-- Some more processingSET @OutputResult = @OutputResult + 'Update OK. There were ' + @@ROWCOUNT + ' rows updated.' + @CRRETURNYou will need to plan on receiving the Output parameter properly. It's a little different for ASP/ADO than for SQL.There are papers on the sqlteam website that describe handling output parameters.Sam |
 |
|
|
|
|
|