How to copy Database Structure from one db to another w/o affecting data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • spamproof2005@yahoo.com

    How to copy Database Structure from one db to another w/o affecting data

    Is there a way to copy the structure from one database to another
    without affecting the actual data?

    For example, I added new fields and stored procedures to a db in my
    development environment. There are a lot of them.

    I now want to make the same changes to my production environment db but
    don't want to affect the data. Only the fields, stored procs &
    constraints and stuff pertaining to the structure of the db should be
    changed.

    Does anyone know of a program that can do this or can this be done in
    MS SQL Enterprise Manager.

    Any help would be appreciated.

    7078895

  • Simon Hayes

    #2
    Re: How to copy Database Structure from one db to another w/o affecting data


    <spamproof2005@ yahoo.com> wrote in message
    news:1107186101 .070726.276200@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > Is there a way to copy the structure from one database to another
    > without affecting the actual data?
    >
    > For example, I added new fields and stored procedures to a db in my
    > development environment. There are a lot of them.
    >
    > I now want to make the same changes to my production environment db but
    > don't want to affect the data. Only the fields, stored procs &
    > constraints and stuff pertaining to the structure of the db should be
    > changed.
    >
    > Does anyone know of a program that can do this or can this be done in
    > MS SQL Enterprise Manager.
    >
    > Any help would be appreciated.
    >
    > 7078895
    >[/color]

    You can generate object creation scripts from Enterprise Manager, then run
    them on the production system, but this can only create objects, it can't
    compare them, so it's fine for stored procs, but not for adding individual
    columns to tables. Alternatively, there are third-party tools available,
    such as this one:

    Try Redgate SQL Compare - compare two SQL Server databases, synchronize the differences, automate comparisons, and manage database versioning issues.


    However, the real answer is probably that you need source control for your
    SQL code, as well as a standard deployment method and/or tool. There are
    lots of discussions in this newsgroup (and others) about this - you can
    search for "source control" to find them.

    Simon


    Comment

    • Erland Sommarskog

      #3
      Re: How to copy Database Structure from one db to another w/o affecting data

      (spamproof2005@ yahoo.com) writes:[color=blue]
      > Is there a way to copy the structure from one database to another
      > without affecting the actual data?
      >
      > For example, I added new fields and stored procedures to a db in my
      > development environment. There are a lot of them.
      >
      > I now want to make the same changes to my production environment db but
      > don't want to affect the data. Only the fields, stored procs &
      > constraints and stuff pertaining to the structure of the db should be
      > changed.
      >
      > Does anyone know of a program that can do this or can this be done in
      > MS SQL Enterprise Manager.[/color]

      In addition to Simon's post, I like to add that there is no tool in
      this whole wide world that can read your thoughts and do what you want.
      Sure, loading new stored procedures is piece of cake. But if you have
      addded, changed or drop columns, there needs to be a human to decide
      what is going to happen with the data. A tool can generate a boiler-
      plate for you, but you are setting your data at risk, if you run it
      without reviewing. And testing. (Take a backup of the production
      environment, and run the update script there until everything seems
      fine.)



      --
      Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

      Books Online for SQL Server SP3 at
      Accelerate your AI application's time to market by harnessing the power of your own data and the built-in AI capabilities of SQL Server 2025, the enterprise database with best-in-class security, performance and availability.

      Comment

      Working...