473,626 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1099
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******** *****@TK2MSFTNG P02.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******** *******@TK2MSFT NGP02.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
1586
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 methodologies.. Etc etc ???????
4
4742
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 tuning and monitoring REORGS on large tables. I am used to the wealth of usage notes in mainframeland. I am recommending the implementation of clustering indexes and wholesale reorging of several large tables (up to 37GB)/ 200 mill plus rows.
2
1760
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 planned out the basic structure of the tables and fields. However, my experience with Access is limited to doing all the work within Access, so I have a couple of issues I'm confused about.
2
4750
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
1503
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 some DB development. I assumed that I would stay with Access but noticed that there is some type of SQL server that comes with Visual Studio 2005 and also in the Express editions as well. I am using this in a single user environment on a PC...
2
4465
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. thanks. --
11
1459
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 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...
1
1363
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 application that I am going to build. Thanks, Max
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6119
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.