473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Planning on going with dynamic SQL, but...

I've read a few posts on the stored procedure vs dynamic sql debate. I ran
a few performance test for myself and it appears to be a wash.

Given that, I'm leaning toward dynamic sql mostly because it would mean one
fewer place to have things.

But, before we go that route we wanted to ask the question:

Is there any compelling reason why we shouldn't abandon all of our stored
procs and just write the SQL inside inside our functions in our business
layer (essentially our data access layer)?

Or, is it just preference these days?

I was leaning toward procs, but I have to admit it would be nice not to have
to keep up with all of them per all of our functions that call them.

Thanks,
Ron
Jun 13 '07 #1
5 1091
On Jun 13, 7:01 pm, "Ronald S. Cook" <r...@westinis.comwrote:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran
a few performance test for myself and it appears to be a wash.

Given that, I'm leaning toward dynamic sql mostly because it would mean one
fewer place to have things.

But, before we go that route we wanted to ask the question:

Is there any compelling reason why we shouldn't abandon all of our stored
procs and just write the SQL inside inside our functions in our business
layer (essentially our data access layer)?

Or, is it just preference these days?

I was leaning toward procs, but I have to admit it would be nice not to have
to keep up with all of them per all of our functions that call them.

Thanks,
Ron
I like sprocs because I can change what a procedure does without
having to recompile and redistribute the application. ClickOnce takes
care of a lot of the hassle, but many of my applications are long
running and aren't restarted very often, so it might take a while for
the updates to all take affect. If I use a stored procedure than when
I update it it affects all users, immediately. To me, it depends on
what the application is going to do, how many updates I can expect,
what types of updates there are going to be, and the environment the
application will run in.

Just my two cents.

Thanks,

Seth Rowe

Jun 13 '07 #2
"Ronald S. Cook" <rc***@westinis.comwrote in
news:#7*************@TK2MSFTNGP02.phx.gbl:
Is there any compelling reason why we shouldn't abandon all of our
stored procs and just write the SQL inside inside our functions in our
business layer (essentially our data access layer)?

Or, is it just preference these days?
It's preference. I like to compile my SQL into the code.

However, SPs could be safer due to the use of parameters which prevent SQL
injection attacks - but if you write your SQL correctly by using
SQLParameters you'll be fine either way.

P.S. check out a data access layer generator like LLBLGen Pro - they make
writing dynamic SQL a lot easier (no need to write SQL, everything is
code).
Jun 14 '07 #3
Ronald S. Cook wrote:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran
a few performance test for myself and it appears to be a wash.
"The Curse and Blessings of Dynamic SQL"
http://www.sommarskog.se/dynamic_sql.html

The part that was of most interest to me is that if you use parameters with
dynamic SQL then execution plans can be re-used, if that's what you're
hinting about performance issues.

Andrew
Jun 14 '07 #4
About "wash" - depends what tests you did and how.
Generally speaking spocs are faster by definition, because db engine is
expected to prepare execution plan during procedure creation, not during run
time. With dynamic sql you always have additional processing for analysis
and selection of plan. Which might be not that important when you don't
process heavy volumes. I see always a speedup with sprocs. Not much, but
nevertheless.

About last point - I believe you have to keep up with all of them - be it
sprocs, or dynamic statements and maintenance effort is approximately same.
But SP you can modify during run-time and for all clients in one step, which
is impossible for hard-coded stuff

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:%2***************@TK2MSFTNGP02.phx.gbl...
I've read a few posts on the stored procedure vs dynamic sql debate. I
ran a few performance test for myself and it appears to be a wash.

Given that, I'm leaning toward dynamic sql mostly because it would mean
one fewer place to have things.

But, before we go that route we wanted to ask the question:

Is there any compelling reason why we shouldn't abandon all of our stored
procs and just write the SQL inside inside our functions in our business
layer (essentially our data access layer)?

Or, is it just preference these days?

I was leaning toward procs, but I have to admit it would be nice not to
have to keep up with all of them per all of our functions that call them.

Thanks,
Ron

Jun 15 '07 #5
On Jun 13, 6:01 pm, "Ronald S. Cook" <r...@westinis.comwrote:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran
a few performance test for myself and it appears to be a wash.

Given that, I'm leaning toward dynamic sql mostly because it would mean one
fewer place to have things.

But, before we go that route we wanted to ask the question:

Is there any compelling reason why we shouldn't abandon all of our stored
procs and just write the SQL inside inside our functions in our business
layer (essentially our data access layer)?

Or, is it just preference these days?

I was leaning toward procs, but I have to admit it would be nice not to have
to keep up with all of them per all of our functions that call them.

Thanks,
Ron
My preference is stored procedures mostly because it allows me to
change the logic of the database interaction without recompiling,
testing, and deploying a new version of the application. The other
advantages are just not as important me.
Jun 16 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Logu | last post by:
Hi Any Ideas and Inputs on Cost Estimation/Planning stage of .NET Projects, i.e. things like Function point Analysis, COCOMO and on full planning stages etc etc. Any Frameworks, feasible...
4
by: News | last post by:
I have 18 years of mainframe DB2, and I just starting working with UDB LUW V8.1 FixPack 6 on Sun Solaris last week. I have been dismayed on the lack of detailed info available in the manuals on...
2
by: Atreju | last post by:
I apologize in advance for the x-post, but I am really not sure where this would best be addressed. I am designing a database in MSAccess for which I want to make the front-end in VB. I have...
2
by: Koen | last post by:
Hi all, Is there any example code available somewhere that graphical visualizes a simple network planning (PERT chart)? I have two tables: tblAction: ActionID (PK) Description
8
by: vbDavidC | last post by:
I am wondering if I should use MS Access or SQL server as my database. I have a little experience programming an Access DB with VB6 (DAO/ADO). I am now starting over with VB2005 and will be doing...
2
by: Logu Krishnan | last post by:
Hi, I'm looking out info on how to perform System Sizing and Capacity Planning for a product built using ASP.NET... is there any specifics ? any pointers to these will be highly appreciated. ...
11
by: Ronald S. Cook | last post by:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran a few performance test for myself and it appears to be a wash. Given that, I'm leaning toward dynamic sql mostly...
1
by: Max2006 | last post by:
Hi, Is there any guide explains how to calculate the hardware requirement for an application? I am looking for a way to have a rough estimate how much CPU power and RAM do I need for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.