Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a store procedure in which i used view for getting data. so it is good or can i user tables instead of view
Posted
Comments
NowYouSeeMe 16-Oct-14 2:24am    
it depends..if you have a table with 200 columns and you need only 10 columns then using view is the faster-better approach
Dj@y 16-Oct-14 5:10am    
i am getting data from 8 tables in view. and use that view in sp and all tables have more than 10 columns. so can I use the view or 8 tables. which one is better for me

whether you use a select statment or a veiw you will be pulling data off the drives (or cache) to produce the answer. The view has the advantage of being pre-optimized. Views are generally used for this type of thing as it hides all the aggregation.
 
Share this answer
 
Comments
Bernhard Hiller 16-Oct-14 4:54am    
Let me add that Microsoft SQL server has many built-in optimizations: having executed a query once, some steps stay cached, e.g. the execution plan. That means, when calling it the second time, the performance will be better than at first time, and differences to pre-optimized views disappear.
Hi,

Check this

What is the difference between view and tables in sql[^]

Hope this will help you.

Cheers
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900