I develop a software system that runs on multiple computers that connect to a centralized database.

At this point in time, all SQL queries are inline with the applications source code. I would like to start migrating these into stored procedures.

If I need to make a change to a stored procedure that will require a software change, how can I synchronize the updates? For example: I change sp_SelectRecordByID and publish an update for the software. Immediately, all running software versions will receive an error upon running sp_SelectRecordByID. Once they crash and the update is received, all is good.

How do I prevent this scenario?

I've come up with a few ideas:

  • Make a new stored procedure and let the old one die off slowly
  • Add version checking to the stored procedure. This is highly undesirable.

Are there more effective methods or am I stuck with these options?

有帮助吗?

解决方案

From what I understood this is more of a deployment issue. The way I see it there are couple options.

If you can deploy SQL Server and application changes simultaneously (or at least near to that) then you can just publish both at the same time but I guess it depends on the system.

Can you do this over the weekend when there is no risk of applications crashing?

Do you deploy the new application version to all users at once? If yes then you can just create new SP first, deploy new application version and then delete old SP.

Anyway, hope this helps. If not, please provide more details on number of servers, number of client applications and such…

其他提示

Are you using Visual Studio? You can keep your stored procedures in a database project and have version control this way.

More info in here: http://msdn.microsoft.com/en-us/library/xee70aty.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top