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.
| Author |
Topic |
|
dba_raf
Starting Member
2 Posts |
Posted - 2010-02-02 : 09:18:10
|
| Hi,I've 2 databases in SQL Server 2005: "db_old" and "db_new"I'd like to compare structure of the databases and particularly to update the structure of db_old to db_new.I would like to compare: tables, views, columns, sequences, triggers, etc.In Oracle, for compare my databases I used the DBLINK with following query:--tables present in new and not in old:select TABLE_NAMEfrom user_tablesminusselect TABLE_NAMEfrom user_tables@NEW_TO_OLDorder by 1;--views present in new and not in old:select view_NAMEfrom user_viewsminusselect view_NAMEfrom user_views@NEW_TO_OLDorder by 1;--columns present in new and not in old:SELECT TABLE_NAME, COLUMN_NAMEFROM USER_TAB_COLUMNSMINUSSELECT TABLE_NAME, COLUMN_NAMEFROM USER_TAB_COLUMNS@NEW_TO_OLDORDER BY 1;--sequences present in new and not in old:select sequence_namefrom user_sequencesminusselect sequence_namefrom user_sequences@NEW_TO_OLD;--PK present in new and not in old:select table_name, constraint_namefrom user_constraintswhere constraint_namein (select constraint_namefrom user_constraintsminusselect constraint_namefrom user_constraints@NEW_TO_OLD)and constraint_type='P'and constraint_name not like 'SYS%'order by 1;How can I generate scripts like for sql server?Thanks in advance! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-02 : 09:31:49
|
| http://www.sql-server-performance.com/articles/dba/database_comparison_sp_p1.aspx |
 |
|
|
|
|
|