I have written a stored procedure in SQL Server which will return a Bigint value
alter procedure [dbo].adding
@one bigint,
@two bigint,
@startid bigint output
as
begin
set @startid = @one + @two
return @startid
end
But while returning value I am getting an exception
Arithmetic overflow error converting expression to data type int
Can any one please help me to solve this issue?
Thanks in advance
Note : Above query is not the exactly the same procedure which i am using
UPDATED :
I have a code like below
_lookupId = cmdInsert.Parameters.Add("RetVal", SqlDbType.BigInt);
_lookupId.Direction = ParameterDirection.ReturnValue;
_procIn01 = cmdInsert.Parameters.Add("@idCount", SqlDbType.VarChar, 500);
cmdInsert.Parameters["@idCount"].Value = idCount;
_procIn01.Direction = ParameterDirection.Input;
_procIn02 = cmdInsert.Parameters.Add("@requestFrom", SqlDbType.VarChar, 100);
cmdInsert.Parameters["@requestFrom"].Value = clientId;
_procIn02.Direction = ParameterDirection.Input;
_pramOut = cmdInsert.Parameters.Add("@startID", SqlDbType.BigInt);
_pramOut.Direction = ParameterDirection.Output;
cmdInsert.ExecuteScalar();
With out returning the value how can i assign the value to "RetVal" my _lookup variable.