☆、在SQLServer中建立存储过程
--DROP PROCEDURE Test;

CREATE PROCEDURE Test
  @aa VARCHAR(15),
  @bb INT,
  @cc VARCHAR(15) OUTPUT,
  @dd INT OUTPUT
AS
BEGIN
  SELECT @cc=UPPER(@aa)
  PRINT @cc
  SELECT @dd=@bb+1
  PRINT @dd
  RETURN
END

/* 在SQLServer中测试
DECLARE @cc VARCHAR(15)
DECLARE @dd INT
EXECUTE Test 'Test Area', 123, @cc, @dd
*/

☆、在Delphi中调用
procedure TForm1.btn1Click(Sender: TObject);
begin
  With ADOQuery1 Do Begin
    Close;
    SQL.Clear ;
    SQL.Add(' EXECUTE Test :aa, :bb, :cc Output, :dd Output ') ;
    Parameters.Items[0].Value := 'Test aa';
    Parameters.Items[1].Value := 1234;
    Prepared;
    ExecSQL;
    Edit1.Text := Parameters.Items[2].Value + ' : ' + IntToStr(Parameters.Items[3].Value);
    Close;
  end;
end;