![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
19/07/2006, 08:15
|
![Avatar de Andres95](http://static.forosdelweb.com/customavatars/avatar83321_1.gif) | Colaborador | | Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 20 años Puntos: 38 | |
lo que pasa es que el RETURN de sql solo regresa enteros....intenta mejor regresar el valor en una variable de salida....
Código:
Using RETURN -- (Referencia: Libros en linea de SQL Server)
The RETURN statement unconditionally terminates a query, stored procedure, or batch. None of the statements in a stored procedure or batch following the RETURN statement are executed.
When used in a stored procedure, the RETURN statement can specify an integer value to return to the calling application, batch, or procedure. If no value is specified on RETURN, a stored procedure returns the value 0.
Most stored procedures follow the convention of using the return code to indicate the success or failure of the stored procedure. The stored procedures return a value of 0 when no errors were encountered. Any nonzero value indicates an error occurred.
Ejemplo:
Código:
CREATE PROCEDURE dbo.V_calcular_factor(
@factor_reactivo float
,@volumen_valorado float
,@volumen_gastado float
,@factor_resultante float output)
AS
If @volumen_valorado > 0
Set @factor_resultante = (@factor_reactivo*@volumen_gastado) /@volumen_valorado
Else
Set @factor_resultante = 0
GO
declare @resultante float
Execute dbo.V_calcular_factor 10,8,3, @resultante output
print @resultante
Resultado : 3.75
Última edición por Andres95; 19/07/2006 a las 08:26 |