Board index » delphi » how to create a Stored procedure with returned parameter in MS SQL Server

how to create a Stored procedure with returned parameter in MS SQL Server

can any one offer me an example of the stored procedure and a procedure in
Delphi which can retrive the returned parameter?
 

Re:how to create a Stored procedure with returned parameter in MS SQL Server


Re:how to create a Stored procedure with returned parameter in MS SQL Server


Quote
eversun <da...@hotmail.com> wrote in message

86j099$nd...@bornews.borland.com...

Quote
> can any one offer me an example of the stored procedure and a procedure in
> Delphi which can retrive the returned parameter?

CREATE PROCEDURE GETTOTAL (@ORDNUM VARCHAR(6), @DATE DATETIME)
AS
 SELECT TOTAL FORM ORDER a
 WHERE a.ORDER=@ORDNUM AND a.DATE=@DATE

This example procedure return the field TOTAL from table ORDER
Bye bye
Simone Santarelli

Re:how to create a Stored procedure with returned parameter in MS SQL Server


Re:how to create a Stored procedure with returned parameter in MS SQL Server


Using the Northwind database :
=================================

CREATE PROCEDURE MyProc

@TotalAmount money OUTPUT

AS

set @TotalAmount = (select sum(Quantity * unitprice) from [order details])

============================================================

In Delphi :

procedure TForm1.Button1Click(Sender: TObject);
begin
  StoredProc1.ExecProc;
  Edit1.Text := StoredProc1.ParamByName('@TotalAmount').AsString;
end;

Make sure you set the ParamType of the @TotalAmount parameter to ptOutput.
--

Alain Quesnel
alainnos...@argosoftware.com

===========

Quote
"eversun" <da...@hotmail.com> wrote in message

news:86j099$ndi23@bornews.borland.com...
Quote
> can any one offer me an example of the stored procedure and a procedure in
> Delphi which can retrive the returned parameter?

Other Threads