Setting aside code for 12 databases in separate database on SQL Server

Tags:
SQL Server
SQL Server database
Stored Procedures
I have 12 databases on my SQL Server, one for each month of the year, and I have almost all the same stored procedures in each database. This architecture is hard to maintain, because you have duplication of the code, and a modification must be made on all the databases. Is there a way to put all my code in a separate database and set up a procedure to pass a database name when I wish the code to be executed?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Putting all the code into a stored procedure database, requires that dynamic SQL code be used. This has several problems the least of which is the security issues that dynamic SQL causes.

I would recommend merging all the 12 databases together so that there is a single system to manage.

Having the data spread across 12 databases makes it very difficult to manage everything (as you have seen).

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following