From: Muhammad Bilal on
Hi

How can i execute a Procedure from within a View in SQL Server 2000.


Regards,
Muhammad Bilal
From: Kalen Delaney on
Hi Muhammad

The short answer is "You can't"

A view is a logical table, just a set of rows. It is not a set of actions to
perform.
One alternative might be to create a table-valued function, which can be
used like a view but can include commands, such as stored procedure calls.

If you told us more about what you want to do, and what version you are
running, we could offer more suggestions.

--
HTH
Kalen
----------------------------------------
Kalen Delaney
SQL Server MVP
www.SQLServerInternals.com

"Muhammad Bilal" <MuhammadBilal(a)discussions.microsoft.com> wrote in message
news:79318C7E-23EA-4141-93B7-D330A843B7BC(a)microsoft.com...
> Hi
>
> How can i execute a Procedure from within a View in SQL Server 2000.
>
>
> Regards,
> Muhammad Bilal

From: Hugo Kornelis on
On Mon, 19 Apr 2010 07:41:38 -0700, Kalen Delaney wrote:

>One alternative might be to create a table-valued function, which can be
>used like a view but can include commands, such as stored procedure calls.

Hi Kalen,

No, it can't. Commands used in a table-valued function are not allowed
to have side effects. And since that can't be guaranteerd of stored
procedures, calling them is not allowed. Well, at least not in any easy,
straight-forward ways - there are workarounds.

>If you told us more about what you want to do, and what version you are
>running, we could offer more suggestions.

I think that would be the best option.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis