March 28, 2012 at 5:19 am
Hi,
is there a way, to call/exec a Stored Procedure from a View (SQLS 2008/R2)?
😉
Thanks and Best Regards
Nicole
March 28, 2012 at 5:35 am
I tell you Why? ... There are a few front-end programs that can run only views - but unfortunately no SP.
That's all...
March 28, 2012 at 5:49 am
No, it's not possible.
March 28, 2012 at 6:49 am
depending on what the procedure was doing, you might be able duplicate the logic from the proc in a view by using a CTE or two, but again it really depends on what the proc was doing.
Lowell
March 28, 2012 at 6:55 am
Sounds like they're using entity framework and only use the views. Well another option is to create a table and populate it w/ the data u want then select from it using a view. How often u will need to insert/update/delete would depend on how often the data changes of course. If you're using sql server 2008 you can play w the merge statment for manipulating the data in said table.
March 28, 2012 at 7:00 am
also, a view can use or call a function, so if the proc can be converted to a function, that is another option.
Lowell
March 28, 2012 at 8:07 am
Lowell (3/28/2012)
also, a view can use or call a function, so if the proc can be converted to a function, that is another option.
Performance however becomes, uhm, bad, from my experience.
Had one of my developers do that here, rewrote it to not use a function in the view but expand the code out and took run time on a report from 2 days to about 10 minutes.
March 28, 2012 at 8:11 am
Anders Pedersen (3/28/2012)
Lowell (3/28/2012)
also, a view can use or call a function, so if the proc can be converted to a function, that is another option.Performance however becomes, uhm, bad, from my experience.
Had one of my developers do that here, rewrote it to not use a function in the view but expand the code out and took run time on a report from 2 days to about 10 minutes.
yeah absolutely! , the functions GOT to be rewritten as an inline table value function;
otherwise if it's scalar or not inline, performance can bite you in the ...um... well wherever performance hurts.
i've been trying to make it a habit of writing only inline table value functions.
Lowell
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply