0

これは次のように行うことができないため:

select * from (call my_stored_procedure(params));

上記のステートメントに代わるものはありますか?

4

2 に答える 2

1

プロシージャは、それぞれが独自のスキーマを持つ複数の結果セットを返す可能性があります。SELECT ステートメントでの使用には適していません。

ユーザー定義関数はオプションである可能性があります。次に例を示します。

CREATE FUNCTION CubicVolume
 -- Input dimensions in centimeters
 (@CubeLength decimal(4,1), @CubeWidth decimal(4,1),@CubeHeight decimal(4,1) )
  RETURNS decimal(12,3) -- Cubic Centimeters.
  AS
  BEGIN
   RETURN ( @CubeLength * @CubeWidth * @CubeHeight )
 END

このリンクの詳細: http://msdn.microsoft.com/en-us/library/aa175085%28SQL.80%29.aspx

于 2013-03-21T09:08:53.637 に答える
0

一時テーブル変数を作成し、次のように sp 値を挿入します。

Declare @t table
(
  --column numbers will be equals to the numbers return by SP
)
Insert Into @t
call my_stored_procedure(params)

Select * From @t
于 2013-03-21T09:10:05.567 に答える