請幫忙
在sql 中實現帶輸出參數的存儲過程和函數該如何寫﹐并注該如何調用﹖(可舉一簡單例子)

解决方案 »

  1.   

    Create Procedure Example
    (@a int,
    @b int output)
    as 
    set @b=23调用
    declare @b int
    exec Example 
    1,@b output
      

  2.   

    謝我想實現這樣一種功能﹐你看該怎么實現
     由外部傳進一個參數﹐然后在表中以此參數過濾﹐再統計出某一字段的sum值﹐再通過輸出參數輸出。
    問﹕1﹑存儲過程該怎么寫﹖
        2﹑在delphi中該怎么調用
      

  3.   

    Use a TADOStoredProc object when a client application must use a stored procedure in a database. A stored procedure is a grouped set of statements, stored as part of a database抯 metadata (just like tables, indexes, and domains), that performs a frequently-repeated, database-related task on the server and passes results to the client.Note: Not all database servers support stored procedures. See a specific server抯 documentation to determine if it supports stored procedures.Many stored procedures require a series of input arguments, or parameters, that are used during processing. TADOStoredProc provides a Parameters property that enables an application to set these parameters before executing the stored procedure.TADOStoredProc reuses the Parameters property to hold the results returned by a stored procedure. Parameters is a collection of TParameter objects, each representing an individual parameter for the stored procedure. Depending on server implementation, a stored procedure can return either a single set of values, or a result set similar to the result set returned by a query.