Ver Mensaje Individual
  #1  
Antiguo 08-09-2004
Avatar de sarackganda
sarackganda sarackganda is offline
Miembro
 
Registrado: may 2003
Posts: 28
Reputación: 0
sarackganda Va por buen camino
TSQLStoredProc y parámetros ptInputOutput con SqlServer

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!
__________________
Sarackgand in the workshop wrassaraba!
Responder Con Cita