Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

What are the benefits of putting SQL code in stored procedure rather than embed it in a webpage?

I've thought of few but are there others? Also which is best practice and why?

Some benefits of a sproc Security Performance Re-usability

thanks

share|improve this question
Which RDBMS are you working with? – Thomas Stringer Oct 14 '12 at 21:13
Almost assuredly C# and SQL Server 2008 – jcolebrand Oct 15 '12 at 2:15
Its a weird mix SQL 2008 Enterprise and PHP – davey Oct 15 '12 at 8:30

closed as not a real question by jcolebrand Oct 15 '12 at 2:55

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

It sounds like you're asking effectively the same thing as this Stack Overflow question: What are the pros and cons to keeping SQL in Stored Procs versus Code

Or the one answered here: http://www.jstawski.com/archive/2007/07/09/stored-procedures-vs-in-line-sql.aspx
and here: http://forums.asp.net/t/1635129.aspx/1

But you could be asking about this: What are the arguments against or for putting application logic in the database layer?

Because I feel like this is an answered question, and because this question is fairly well answered and an age-old debate, I'm closing this question and preventing voting on this answer. Enjoy.

If you deem this question "not answered" and think it deserves an objective answer that can be fairly given, let there be a meta discussion, and comment on the Q above with a link to your meta post. (this goes for everyone, not just OP)

share
locked by jcolebrand Oct 15 '12 at 2:55

This post has been locked while disputes about its content are being resolved. For more info visit meta.

Not the answer you're looking for? Browse other questions tagged or ask your own question.