Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 24th, 2011, 12:00 AM
Authorized User
 
Join Date: Oct 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stored Procedures vs Parameterized Queries

Stored Procedures vs Parameterized Queries....

I am trying to develop good habits and practices and before I tie myself to either approach would like to hear what others have to say on the matter. It's an old debate and even after googling and reading the results I still don't know which way to go!

At the moment I favour parameterized queries.
I will be working mainly on my own projects in asp.net, and am certain my work will not be ported over to other platforms in the future.
I see no perfomance or security advantages in either approach.
Stored procedures seem to add a level of abstraction which offers little of use.
I also find it a nuisance to open up a seperate app to debug sql.

Anyone with some words of wisdom before I commit myself to my decision....?
 
Old December 24th, 2011, 07:11 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,
Quote:
Stored procedures seem to add a level of abstraction which offers little of use.
They indeed do add an additional level of abstraction but not without offering additional benefits. What I like about stored procedures is reuse and maintainability. It's a lot easier to make a change to a stored procedure than to make the same change in code as you don't have to deploy the entire application.

Quote:
I also find it a nuisance to open up a seperate app to debug sql.
Not sure exactly what you mean with debug your SQL; if you mean manage and change your code, you can do most of it with the built-in tools. In addition, the upcoming Juneau project may bring SQL development closer to Visual Studio:
http://msdn.microsoft.com/en-us/magazine/hh394146.aspx

Based on your description, I'd say either option works. Just pick what you feel most comfortable with.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 24th, 2011, 07:50 AM
Authorized User
 
Join Date: Oct 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there Imar,

Well if it's the way you do it, then it'll be my way too!

I'm sure I'll experience one of those eureka moments (of which I have had many this last year) when it all suddenly makes sense....

regards, Guy
 
Old December 24th, 2011, 08:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

But what about EF though? With EF I hardly have the need to write any paramaterized query or stored procedure at all. Granted, you lose the option to make changes without deploying but you get a lot of power and flexibiliy in return.

Especially EF using Code First gives you a lot of power, at the cost of a pretty steep learning curve.

http://msdn.microsoft.com/en-us/data/aa937723
http://blogs.msdn.com/b/adonet/archi...lkthrough.aspx

This is "just" an alternative; you don't have to do Code First when using EF, but it's a model I really like.

Here's to hoping you'll have many Eureka moments.... ;-)

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 data from parameterized stored procedures scott.smith BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 0 August 13th, 2009 11:17 AM
Implement parameterized queries in vb6 Jade08 VB How-To 7 August 27th, 2008 12:49 PM
Parameterized CRystal report & Stored procedure jay4ever_2000 ASP.NET 1.0 and 1.1 Professional 3 June 6th, 2006 08:53 AM
Converting Access Queries Into Stored Procedures markw SQL Language 1 March 15th, 2005 11:49 AM
Pass-through queries vs stored procedures kendawg Access 2 October 8th, 2003 02:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.