Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Functions and SPROCS

Author  Topic 

Robowski
Posting Yak Master

101 Posts

Posted - 2013-06-25 : 16:19:34
Anyone come across a sort of dummys guide article to using SPROCS, functions and views?

It seems inline/table valued functions, views and sprocs can often be used to return the same result but the main thing in SQL is performance and performance is key!

So I know you can use the query execution plan to analyse how each work and through experience learn what's best for when but is there sort of basic rules?

Like if you want to automate something to update something without the user having direct access you would use a SPROC for example...

Hope this make sense!

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-06-25 : 22:13:17
There is nice YouTube video on this topic, titled:
Choosing Between Views, Functions, and Stored Procedures in SQL
http://www.youtube.com/watch?v=tdOiRT3HMxo

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 02:08:11
It seems inline/table valued functions, views and sprocs can often be used to return the same result
why that can sometimes be correct, the usage of a particular type of module depends on certain other factors as well. For example if you need to use the resultset as a part of query with join/IN operation you may be better off using UDF over SProc. Similarly if you want a resultset based on parameter selection, use SPRoc over views etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -