M
M
MADm2015-06-17 11:26:59
SQL Server
MADm, 2015-06-17 11:26:59

How to change the return data of a procedure?

I use a certain helper in sharp which takes the returned data of procedure. The point is that in the procedure you simply specify

select 0
return

and the helper returns that data.
The problem is that if you take the data several times, only 1 set will be returned.
select 1
select 0
return

will return 1
You can build the code branches correctly, but I call another procedure and it returns the data earlier.
How can I clear or not take the data that is returned from exec %procname% ? return them to a variable like this exec @v = %procname% tried, didn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Lastochkin, 2015-06-17
@lasalas

1. In C#, you can read multiple datasets using SqlDataReader.NextResult()
2. Getting a dataset when calling HP:

CREATE TABLE #T ( 
    V INT
)

INSERT INTO #T(V) EXEC MyProc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question