Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Create a view from a stored procedure

Author  Topic 

gabil
Starting Member

4 Posts

Posted - 2010-02-12 : 10:40:08
Hi there,

I want to use a stored procedure to creat a view.
What would be the best solution for this?

Thank you very much

GG

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-12 : 10:42:40
why do you want to create a view inside a procedure?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-12 : 10:48:18
Took the words right out of my mouth!
Go to Top of Page

gabil
Starting Member

4 Posts

Posted - 2010-02-12 : 10:49:52
Somebody else is creating a web report from a view. (an existing one)
In fact I had to modify that view but I can not use temporary tables.
So I created a SP to be used for that report.

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-12 : 10:51:16
quote:
Originally posted by gabil

Somebody else is creating a web report from a view. (an existing one)
In fact I had to modify that view but I can not use temporary tables.
So I created a SP to be used for that report.

Thank you


thats fine. but why do you need to create a view for that. you can just create a sp which gives resultset that report can make use of

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

gabil
Starting Member

4 Posts

Posted - 2010-02-12 : 10:53:47
I told him the same thing.
He is working on this approuch
but just in case he has problems I want to be prepared.

(and also that I want to learn something new :-) )

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-12 : 11:07:30
not a good method to create a view inside procedure (you dont need to). If you need a view at all, creation has to happen before procedure.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

gabil
Starting Member

4 Posts

Posted - 2010-02-12 : 11:16:09
Thank you
Go to Top of Page
   

- Advertisement -