|
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]
|