Tengo el siguiente store procedure en un SqlServer 2000:
Código SQL
[-]ALTER procedure dbo.fn_LogIn (@viTerminalId Int, @viSesionRemota Int, @viResult Int Output) AS
BEGIN
INSERT INTO SESION
(TERMINAL_ID, SESION_REMOTA_ID)
VALUES
(@viTerminalId, @viSesionRemota);
SELECT @viResult = SCOPE_IDENTITY();
END;
Si lo ejecuto de la consola, devuelve un valor sin problemas
Código SQL
[-]declare @Result int
execute dbo.fn_LogIn 1, 2, @Result OUTPUT
select @Result
Pero intento ejecutarlo desde un TSQLStoredProc y nunca retorna un valor:
Código Delphi
[-]with TSQLStoredProc.Create(Self); do
try
SQLConnection := FDataBase;
StoredProcName := 'dbo.fn_LogIn';
Params[1].AsInteger := 1;
Params[2].AsInteger := 999;
ExecProc;
ShowMessage(Params[3].AsString);
finally
Free;
end;
PD: Si utilizo parámetros del tipo bigint en el store procedure, produce un EBcdOverflowException
Chagracia!