Unix Technical Forum

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

This is a discussion on How to copy Database Structure from one db to another w/o affecting data within the SQL Server forums, part of the Microsoft SQL Server category; --> Is there a way to copy the structure from one database to another without affecting the actual data? For ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 06:52 AM
spamproof2005@yahoo.com
 
Posts: n/a
Default 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 06:52 AM
Simon Hayes
 
Posts: n/a
Default 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.googlegr oups.com...
> 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
>


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:

http://www.red-gate.com/SQL_Compare.htm

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 06:53 AM
Erland Sommarskog
 
Posts: n/a
Default Re: How to copy Database Structure from one db to another w/o affecting data

(spamproof2005@yahoo.com) writes:
> 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.


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@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:44 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com