f



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

0
1/31/2005 3:41:41 PM
comp.databases.ms-sqlserver 14567 articles. 1 followers. janinepelletier (108) is leader. Post Follow

2 Replies
434 Views

Similar Articles

[PageSpeed] 23

<spamproof2005@yahoo.com> wrote in message 
news:1107186101.070726.276200@f14g2000cwb.googlegroups.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


0
sql (2120)
1/31/2005 4:28:03 PM
 (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/techinfo/productdoc/2000/books.asp
0
esquel (7068)
1/31/2005 10:56:39 PM
Reply: