SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 When to use stored procedures
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kpgraci
Yak Posting Veteran

65 Posts

Posted - 05/07/2012 :  11:16:14  Show Profile  Reply with Quote
I have a web app that uses web services to read and write to a sql database.

I initially wrote all the queries as stored procedures because I was told that is the most efficient. The queries I use are rater basic, the retrieve one or more records based on parameters, or update a single record.

Later I read that doing a single query one at a time like this that stored procedures offered no real performance benefit. The discussion listed times when it would be beneficial to use stored procedures, and I don;t remember what that was but I did none of those things.

So for simple, call one at a time when the user requests a get or put operation, is there a performance benefit to using stored procedures?



kpg

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 05/07/2012 :  14:15:37  Show Profile  Reply with Quote
Even if the queries are very simple and performance is not a consideration, I would try to use stored procs at least for two other reasons:

a) security
b) maintainability (for example, if you need to change the schema of a table, if you allow ad-hoc queries, you would be in a bind to dig out all the places in client code where they may be referring to the table).

And, performance is NEVER not a consideration, so stored procs would help in that too via plan reuse etc.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000