Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 49709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:28:45+00:00 2026-05-10T16:28:45+00:00

Do you guys keep track of stored procedures and database schema in your source

  • 0

Do you guys keep track of stored procedures and database schema in your source control system of choice?

When you make a change (add a table, update an stored proc, how do you get the changes into source control?

We use SQL Server at work, and I’ve begun using darcs for versioning, but I’d be curious about general strategies as well as any handy tools.

Edit: Wow, thanks for all the great suggestions, guys! I wish I could select more than one ‘Accepted Answer’!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:28:46+00:00Added an answer on May 10, 2026 at 4:28 pm

    We choose to script everything, and that includes all stored procedures and schema changes. No wysiwyg tools, and no fancy ‘sync’ programs are necessary.

    Schema changes are easy, all you need to do is create and maintain a single file for that version, including all schema and data changes. This becomes your conversion script from version x to x+1. You can then run it against a production backup and integrate that into your ‘daily build’ to verify that it works without errors. Note it’s important not to change or delete already written schema / data loading sql as you can end up breaking any sql written later.

    -- change #1234 ALTER TABLE asdf ADD COLUMN MyNewID INT GO  -- change #5678 ALTER TABLE asdf DROP COLUMN SomeOtherID GO 

    For stored procedures, we elect for a single file per sproc, and it uses the drop/create form. All stored procedures are recreated at deployment. The downside is that if a change was done outside source control, the change is lost. At the same time, that’s true for any code, but your DBA’a need to be aware of this. This really stops people outside the team mucking with your stored procedures, as their changes are lost in an upgrade.

    Using Sql Server, the syntax looks like this:

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_MyProc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [usp_MyProc] GO  CREATE PROCEDURE [usp_MyProc] (     @UserID INT ) AS  SET NOCOUNT ON  -- stored procedure logic.  SET NOCOUNT OFF  GO   

    The only thing left to do is write a utility program that collates all the individual files and creates a new file with the entire set of updates (as a single script). Do this by first adding the schema changes then recursing the directory structure and including all the stored procedure files.

    As an upside to scripting everything, you’ll become much better at reading and writing SQL. You can also make this entire process more elaborate, but this is the basic format of how to source-control all sql without any special software.

    addendum: Rick is correct that you will lose permissions on stored procedures with DROP/CREATE, so you may need to write another script will re-enable specific permissions. This permission script would be the last to run. Our experience found more issues with ALTER verses DROP/CREATE semantics. YMMV

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First step would be to compare record counts. You can… May 11, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer I have to come up with a contrived method to… May 11, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer use an inner join to omit unmatched records select *… May 11, 2026 at 8:57 pm

Related Questions

How do you associate a -mouseUp: event with the -add: method of a NSArrayController?
Another synchronization question...I hope you guys don't get annoyed ;) Assume the following scenario:
So I'm newly in charge of projects at my company (We're still only 2
I know this question has been asked a bit before. But looking around I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.