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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 suppressing EXEC OUTPUT?

Author  Topic 

tpk
Starting Member

10 Posts

Posted - 2003-03-25 : 10:21:50
Hi. Anyone know if it is possible to suppress query analyzer from giving results when you EXEC a SPROC which has an OUTPUT value? I want to get the value, assign it to a variable and use it later. Since one of my SQL scripts creates about 4000 records and each gets a value from EXEC'ing a SPROC, QA comes up with low resource messages, due I presume from trying to display all the OUTPUT's when I don't even want it to.

DECLARE @myValue nvarchar(50)
EXEC spMySproc @myValue OUTPUT

The above gives QA grid results which I don't want. I just want @myValue given the result of the EXEC

Thanks.
Carl.

Edited by - tpk on 03/25/2003 10:22:45

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-25 : 10:50:17
You can use INSERT .... EXEC .... syntax to insert the resultset of a proc into a table.

I have to wonder how useful a proc is that returns so much data that you client machine runs out of RAM....

Jay White
{0}
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-03-25 : 11:16:13
I wonder if this helps: add SET NOCOUNT ON to the beginning of the batch.

OS

Go to Top of Page

tpk
Starting Member

10 Posts

Posted - 2003-03-25 : 11:20:21
Page47, thanks, I suppose that with that workaround I'd have to use a temp table. Regarding why the 4000 records output? It's a large batch script setting up a new instance of a web app. I'm not sending the results to the client.

NOCOUNT didnt help but thanks mohdowais.

Go to Top of Page

tpk
Starting Member

10 Posts

Posted - 2003-03-25 : 11:58:48
I worked around my EXEC and output param problems.

As Page47 said, I used a temp table to store the output value in the SPROC before passing it out. EXECUTING an INSERT INTO..SELECT statement.

This also got around another problem I found which was that the output param was not being assigned to my output variable (@myValue) in my orig post, if the called sproc was EXECUTING a dynamically built SQL string.

Not sure that makes much sense but in summary, THANKS, I got it working!



Edited by - tpk on 03/25/2003 11:59:05
Go to Top of Page
   

- Advertisement -