General information
Forum:
Microsoft SQL Server
Well,
View's
Advantage - Can be indexed. Can denormalize data to simplify your client side multi-join queries. Can use for ROW level security without worrying about it at your client.
Disadvantage - Hard to update to. You may need to use INSTEAD OF triggers.
SP's
Save as views, except can't be indexed.
Advantage - You can pass parameters and this will affect what the SP returns. Also, the SP can return output variables in addition to result sets.
Functions -
I would limit functions to doing a specific thing, but not to replace SP's. For example, say you allow for custom fields and store them as XML in a text field in your table. You could have a function that extracts the specified value. You can use this funtion in a query, view or SP.
Calculated fields -
Don't forget these, they can be helpfull in many places.
As far as what is 'fastest' do you mean, dev time, performance? I think as long as you underliying queries are optimized and your data is properly designed and indexed properly they will all give good performance.
BOb
>Hi,
>
>SQL2K
>
>I have been using stored procedures to return result sets to VFP Front end cursors. It works very well. But - since I'm always looking for a better or faster way to do things, I want to consider using either SQL Server Views (NOT VFP Remote Views!) or possibly UDF() to return my result sets to my cursors - which may as simple as "select * from table", or as complex as 10-12 level inner/left joins using dynamic SQL and passed in where clauses.
>
>Any comments as to advantage (if any) of SQL views or UDF or stored procs?
>
>TIA,
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only