Tuesday, March 27, 2012

Creating a View from a Stored procedure

Hello

Newbie here.

Is there a way of creating a VIEW...using a stored procedure. I am
basically trying to create a view to return some data that I am
getting using a stored procedure.

I have created the procedure and when I execute this its working ok.
The stored procedure uses a datefrom and dateTo which I have set up by
tweaking the getdate() and getdate()-2.

In other words can you create a view like this

CREATE VIEW view_test
AS
exec proc_test
GO

Any help will be greatly appreciated.

RemmyA view is a single SELECT statement. If you can write the stored
procedure as a single SELECT you can make that SELECT into a view.

Otherwise, you might look into Table Valued Functions.

Roy Harvey
Beacon Falls, CT

On Wed, 19 Sep 2007 14:43:04 -0000, apothecary <wamweri@.gmail.com>
wrote:

Quote:

Originally Posted by

>Hello
>
>Newbie here.
>
>Is there a way of creating a VIEW...using a stored procedure. I am
>basically trying to create a view to return some data that I am
>getting using a stored procedure.
>
>I have created the procedure and when I execute this its working ok.
>The stored procedure uses a datefrom and dateTo which I have set up by
>tweaking the getdate() and getdate()-2.
>
>In other words can you create a view like this
>
>CREATE VIEW view_test
>AS
>exec proc_test
>GO
>
>Any help will be greatly appreciated.
>
>Remmy

sql

No comments:

Post a Comment