Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Compare between two database structure.

Author  Topic 

jaypee_s
Starting Member

22 Posts

Posted - 2007-09-24 : 03:01:50
Hi

I have two database, one database is having release 1 , which has latest table structure, the other database having pre release.

How to synchronize between these two database.

What i am doing is compare between these two database and writing alter query.

Is there any other option to full fill my requirement.

Thanks in advance.
jp

Kristen
Test

22859 Posts

Posted - 2007-09-24 : 04:21:34
We script ALL DDL changes we make in development. These form the basis of "patches" that we can apply sequentially to a target database (which for us would be developed on DEV and then applied to QA, BETA, and then client TEST and finally PRODUCTION databases)

All Sprocs, Triggers and the like we store in individual files. We never use the "Properties" function of an Sproc/Trigger to make changes directly in the database. These files are stored in a version control system (we use SubVersion, but any of them would do!) so that we can review changes, revert to earlier versions, compared a released version to a client with our current DEV version, and so on.

If you have DEV and LIVE databases your best bet is probably something like SQL Compare from Red Gate, which will give you a script to freshen the LIVE database to the same state as the DEV database, but in my experience that has issues on release. You find there is some META data you need to add, the sequence of changes is dependant on Foreign keys, you have pre-initiallised a new column added to a table to some suitable default value, and the Compare script doesn't do that ... etc. which is basically why we develop our Change Scripts along with actually making the changes so that we are more confident that they will actually work during deployment.

See also: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Script+Development+Database+Changes+to+Production+Database,Ship+Application+updates,Version+Control

Kristen
Go to Top of Page

jaypee_s
Starting Member

22 Posts

Posted - 2007-09-24 : 04:38:41
Thanks kristen. how to create change script. i am confused here, change script is nothing but a generate script or manually we have to create a script for each schema.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-24 : 04:48:20
My meaning of a Change Script is that you manually create a script every time you make a DDL change to your database, and also for any Meta Data etc. that an update requires - including, for example, setting a column (added to an existing table) on existing rows to some initial value [as distinct from putting a DEFAULT on the column].

I'm sure this sounds like a right royal pain to do, but in practice it isn't that bad.

We use the Table Design tools to make changes. We add columns, indexes, whatever. And then we press the button to create a Change Script, and ABANDON the changes in the Table Design tool. We add the Change Script to our folder of such scripts and then run it on the DEV database. That way we know the script does actually work, and does the job.

And then we don';t have to do ANYTHING extra to get the changes onto a new database, we just run all the change scripts we made (actually we concatenate them all into a single Version1-to-Version2 style script.)

All that is described in the link I gave earlier

Kristen
Go to Top of Page
   

- Advertisement -