output parameters allow stored procedures to return data to the calling code.
Questions tagged [output-parameter]
133 questions
1
vote
3 answers
C# changes output parameter to invalid value and throws error
Using:
Visual Studio 2010
SQL Server 2012
I have a stored procedure, which inserts a new record in the DB and returns the new record ID as an output parameter. I ran the sp manually and it works.
If I run it from my C# application, and I read the…

Jan Solo
- 183
- 1
- 8
- 19
1
vote
1 answer
Write to output parameter with c#
In SQL Server, I can pass a value IN to a stored procedure output parameter, alter it, and then read it back:
CREATE PROCEDURE [dbo].[testSP]
@myOutputParam INT OUTPUT
AS
BEGIN
SELECT @myOutputParam = @myOutputParam + 1
END
GO
DECLARE @x…

mulllhausen
- 4,225
- 7
- 49
- 71
1
vote
1 answer
Output issue in Macros?
I have the following C code:
#include
int x = 2;
int f (int z) { int temp = x; x += 2*z; return temp; }
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) /* side effects may cause error */
int MIN_fix(X,Y) { if (X < Y) return X; else return Y;…

FL93
- 29
- 5
1
vote
1 answer
Creating table with dynamic columns using the PIVOT command
I have the following TSQL that I have been trying, without luck, to do 2 things with:
convert Nulls to 0
output to a temporary table I can use for
other operations.
Part of the result is captured in the attached:
What changes do I need to make…

user938455
- 89
- 11
1
vote
2 answers
SQL Server Output Parameter showing null value in EF C#
I have a below stored procedure with output parameter.
ALTER proc [dbo].[CRS_GetNewMessageCount]
@CaseId int,
@Type varchar(50),
@Location varchar(50),
@Count int out
as
begin
if @location='admin'
begin
if @type='consumer'
select…

Sunil Kumar
- 3,142
- 1
- 19
- 33
1
vote
1 answer
Using LINQ calling a sproc, how can I pass a var back from a method?
I have this method which worked for a while
public string getSlotText(int slotID)
{
DataClasses1DataContext context = new DataClasses1DataContext();
var slotString = context.spGetSlotTextBySlotID(slotID);
return…

Tim Butler
- 39
- 1
- 6
1
vote
1 answer
Output SqlParameter Error: the Size property has an invalid size of 0
I know there are a few other threads/questions about this error, but I wanted to get a bit more insight if possible. We've seen this error occur intermittently for a particular piece of code where we have an Integer type output parameter.
This is…

Dustin Kofoed
- 539
- 1
- 8
- 17
1
vote
4 answers
Use stored procedure output parameter
ALTER PROCEDURE dbo.StoredProcedure8
@emp_code bigint,
@co_id bigint,
@p decimal(8,2) output
AS
SELECT @p = (select sum(tran_value) from emp_ded_ben_trans where emp_code=@emp_code and co_id=@co_id and period_flg=2 and tax_flg=0)
RETURN

shmandor
- 881
- 3
- 14
- 22
1
vote
1 answer
Is it safe to Alter an existing stored procedure to use output parameters?
Can changing an existing parameter of a stored procedure to an output parameter have any impact on existing code?
For context, I have stored procedure which accepts and then modifies an parameter, returning the modified parameter by selecting it. …

Brian
- 25,523
- 18
- 82
- 173
1
vote
1 answer
Why is my output parameter in stored procedure called from Entity Null?
I am calling a stored procedure and declare an output paramters:
CREATE PROCEDURE dbo.usp_getIsReadyForProcess
@VideoId INT ,
@val INT OUTPUT
AS
BEGIN
BEGIN TRY
BEGIN TRANSACTION
-- LOCK ROW UNTIL END OF TRANSACTION
SELECT * FROM…

Sherman Szeto
- 2,325
- 4
- 18
- 26
1
vote
1 answer
MATLAB CUDA Kernel Object- Error using gather?
I have the following CUDAKernel object:
Which I invoke using:
kernel1 = parallel.gpu.CUDAKernel('kcc2.ptx', 'kcc2.cu');
kernel1.ThreadBlockSize = 256;
kernel1.GridSize = 4;
gpuTM = gpuArray(single(TM));
gpuLTM = gpuArray(single(LTM));
gpuLTMP =…

Jordan
- 305
- 3
- 13
1
vote
0 answers
Get Output parameter and Dataset from Stored Procedure using Entity Framework
I'm trying to call the stored procedure attached below using Entity Framework 4.1 to cover 2 possible scenarios:
exec TEST_SP_OUTPUT 1
Should return a dataset from ACTIONTYPE table and @Success = 1
exec TEST_SP_OUTPUT 0
No dataset returned and…

J. Torrecillas
- 41
- 1
- 7
1
vote
2 answers
issue with oracle output parameters in c#
I am so mad at oracle. I have been battling to get two values (output paramaters) from oracle database. I need to get two values (o_unallocated_ledgercode and o_allocated_ledgercode) based on paymentType and vendor.
What issue is: these values…

user1358072
- 447
- 2
- 12
- 26
1
vote
1 answer
C# SqlCommand, XmlReader and output parameter
i have a problem with receiving value of output parameter when i execute stored procedure using SqlCommand. I don't have problem with output parameter when i execute stored procedure not from C# code, but from SQL Server Management Studio. Here is…

Konrad
- 161
- 1
- 1
- 10
1
vote
2 answers
Reading SP with output parameters and result set in C#?
I have created a stored procedure similar to this simplified example:
CREATE PROCEDURE dbo.sp_MyStoredProcedure
@Var1 INT OUTPUT,
@Var2 DECIMAL(10,2) OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SELECT
@Var1 = COUNT(*),
@Var2 =…

Michael Kniskern
- 24,792
- 68
- 164
- 231