473,396 Members | 1,743 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,396 software developers and data experts.

Identical database w/ identical stored procedures?

We have written an application which splits up our customers data into
their individual databases. The structure of the databases is the
same. Is it better to create the same stored procedures in each
database or have them in one central location and use the sp_executesql
and execute the generated the SQL statement.

Thank you.

Mayur Patel

Oct 25 '05 #1
4 1389
Stu
Better in terms of what?

I mean, there are risks with using sp_executesql, and you've already
made the decision to split your data (thus minimizing contamination
and/or infiltration) so it seems a bit odd to allow users to jump into
a common database (but there are ways to do this without
sp_executeSQL)...

What's your criteria for defining "better"?

Stu

Oct 25 '05 #2
Better in terms of performance of SQL Server. B/C if there is one
common stored procedure, then the stored proc will have to create the
sql statement to include which database to perform the action to.
But, is the performance hit to do this really that high compared to
creating the maintence nightmare of updating the same stored procedure
in every database?

Thank you


Stu wrote:
Better in terms of what?

I mean, there are risks with using sp_executesql, and you've already
made the decision to split your data (thus minimizing contamination
and/or infiltration) so it seems a bit odd to allow users to jump into
a common database (but there are ways to do this without
sp_executeSQL)...

What's your criteria for defining "better"?

Stu


Oct 25 '05 #3
SQL
If you have 1 proc I think you will have to use dynamic SQL or a lot of
if's
What's the problem (since all table names are the same anyway)
scripting the proc out and running it on all your DB's how may db's are
you talking about anyway?
Running straigh sp's over dynamic sql is alway better
------------------------------------------------------------------------------------------
"I sense many useless updates in you... Useless updates lead to
defragmentation... Defragmentation leads to downtime...Downtime leads
to suffering..Defragmentation is the path to the darkside.. DBCC
INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with
you" -- http://sqlservercode.blogspot.com/

Oct 25 '05 #4
HeadScratcher (ma***@servicemg.com) writes:
But, is the performance hit to do this really that high compared to
creating the maintence nightmare of updating the same stored procedure
in every database?


That is no maintenance nightmare with proper configuration-management
procedures in place.

First of all, put your source code, tables, stored procedures and all
under version control. Then learn about labelling, using baselines
and so on. To deploy a change, you need to develop an update script.
Yes, you will need to keep track of whether you have run a certain
update script. This can be achieved with a help table in the database.

Having centralised stored procedures, on the other hand, does lead to
maintenance problems, since the code so much more complex.

Also, having procedures in each database gives you more flexibility. Maybe
you have a bigwiz customer that want extra features. Or absolutely flat
out to accept an upgrade for the next two months. And one day you find
you need to scale out, and move some databases to another server.

As for possible tools, there are a couple on the market, whereof some
vendors certain will post a blurb in response to this. (If memory servers
DBGhost people are very fond of this.) I can even offer a solution myself,
which have the distinct advantage of being freeware. That's simply what
we use in our shop, you find it http://www.abaris.se/abaperls/.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Oct 25 '05 #5

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

Similar topics

14
by: Ruby Tuesdays | last post by:
Perhaps you database guru able to suggest what would be a good choice for opensource database platform to use to develop projects. At the moment the project is small/medium, but it will grow in...
4
by: TJ Olaes | last post by:
Hello all, this is my second post to this newsgroup. It's a question about stored procedures and permissions and how these behave between databases. Here's the scenario. I have a database that...
18
by: mountain man | last post by:
Greetings to all database professionals and laymen, Let us make a bold assumption that we have developed a software tool for the SQL Server environment which simply acts as an interface between...
4
by: Minh Tran | last post by:
In order to minimize the number of connection strings I have to use to access different databases on the same Sql Server, I was considering storing all stored procedures in just one database. I...
2
by: Phil | last post by:
I have the following code but do not know the best way to return the updated DataTable back to the database. I believe I can use the Update method of the Data Adapter, BUT if true, I also believe I...
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
2
by: pascal.baetscher | last post by:
Hello everyone, I face currently a problem where I could need some input for searching the source of the Problem System: SQL Server 9.0 I fill from Database A with triggers Database B,...
2
by: ink | last post by:
Hi all, My company does things in a very specific way. Meaning we never query the database directly, we always use Stored Procedures. What i would like is to develop one data provider class...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
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...

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.