How to call Stored Procedure in a View?

前端 未结 7 2209
灰色年华
灰色年华 2020-12-01 07:39

How would I call a Stored Procedure that returns data in a View? Is this even possible?

7条回答
  •  甜味超标
    2020-12-01 08:09

    create view sampleView as 
    select field1, field2, ... 
    from dbo.MyTableValueFunction
    

    Note that even if your MyTableValueFunction doesn't accept any parameters, you still need to include parentheses after it, i.e.:

    ... from dbo.MyTableValueFunction()
    

    Without the parentheses, you'll get an "Invalid object name" error.

提交回复
热议问题