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 |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-11-25 : 23:17:07
|
| hi,i have two databases test1 and test2. theses two databases contains some objects(tables,sp's,etc...........) are in common. so i need to list out which r in common and which r not in common by comparing these two databases. i need to do it manually or any sp or query is there to do it?One can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-25 : 23:35:28
|
[code]select db1.name, db1.type, db2.name, db2.type, in_db1 = case when db1.name is not null then 'Y' else 'N' end, in_db2 = case when db2.name is not null then 'Y' else 'N' endfrom db1.sys.objects db1 full outer join db2.sys.objects db2 on db1.name = db2.name[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-11-25 : 23:53:21
|
| when i am running the above query i am getting erro that "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'db1.sys.objects'."One can never consent to creep,when one feels an impulse to soarRAMMOHAN |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-25 : 23:56:07
|
| Substitute exact database_name in db1 and db2Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-11-25 : 23:59:36
|
| i had used my database names insted of db1 n db2 like xyz.sys.objects, but still error is sameOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-26 : 00:34:22
|
show us your query KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2009-11-26 : 06:33:07
|
| Before we go down the wrong oute...you are using a MSSQL database?If you are - investigate a product supplied by www.red-gate.com. SQLCompare is a professional and good-value tool for this sort of activity. |
 |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2009-11-26 : 09:50:02
|
| You could do tasks->generate scripts. Then compare the output using MS Word or something. |
 |
|
|
|
|
|
|
|