You are here: Re: Views vs Stored Procedures, whats the difference? « MsSQL Server « IT news, forums, messages
Re: Views vs Stored Procedures, whats the difference?

Posted by --CELKO-- on 02/04/06 04:06

>> Personally, I hate views. I can't control what the thing does, and sometimes the optimizer doesn't do what is best. <<

How does the smart money bet?

>> With a stored procedure, I have more options. With the more options, I do have more
responsibilities. <<

Myself, i do not want to have to control 100+ factors that can change
the next time I use the procedure. But T-SQL is a simple one-pass
compiler -- it does nto not re-arrange my if-the-else logic or optimize
my loops.

>> For sure I would agree to learn views first. It teaches data set mentality. <<

Yes. And that is why a newbie likes it better than a VIEW. Suddenly,
you have to change your mindset, how to use DCL and WITH CHECK OPTIONs

>> A couple of dissentions. Within the stored procedure will be the exact same code as is in the view, if you do the basics. The optimizer can optimize that SQL code just like it can in the view.<<

Not really. Procedure programmer will tend to use if-then-else while a
VIEW programmer would tend to use CASE expressions. Procedure
programmer will tend to use temp tables as scratch files while a VIEW
programmer would tend to use CTE and derived tables in the query.

>> Stored procedures can be used to create data sets, and are MUCH more flexible in their capabilities then views. <<

Only because they can take parameters. The two things serve different
purposes

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация