views:

46

answers:

4

Hi All,

I am working on SQL Server 2005. I have took the backup and restore the database. I just wanted to know is there any way I can check whether the data between these two database are diffent. or any script that I can run or check [ could be table by table] to see if any new row added or modified.

EDITED

For example - I have to check the data difference from Database 1 Table_User to Database 2 Table_User.

Thanks

+1  A: 

http://www.sql-server-tool.com/

Anil
Do i need to open Microsoft .NET Framework v2.0 SDK command prompt ???? Or Run > cmd
Zerotoinfinite
i dont think you need any command prompt..it's a separate application you can download and configure for your db connection and start using
Anil
A: 

You can use the built-in command line tool TableDiff.exe:

http://msdn.microsoft.com/en-us/library/ms162843(SQL.90).aspx

It performs row by row comparisons along with column-level comparisons. Here's an article that walks through how to use it:

http://www.databasejournal.com/features/mssql/article.php/3594926/SQL-Server-2005-TableDiff-Utility.htm

And another (with a link to a GUI that you can download):

http://weblogs.sqlteam.com/mladenp/archive/2007/03/03/60125.aspx

This would be on a table by table basis - but it's free and already installed for you since you have SQL Server 2005 installed. Hope this helps!

David Hoerster
Do i need to open Microsoft .NET Framework v2.0 SDK command prompt ????OrRun > cmd
Zerotoinfinite
Should be installed here: `C:\Program Files\Microsoft SQL Server\90\COM\TableDiff.exe` (may differ based on how you installed sql server). Just a basic run > cmd should do it, I believe. It's part of the client tools part of the install.
David Hoerster
A: 

you can use sql compare and sql data compare.(red-gate.com) or you can use sql delta.(sqldelta.com)

onder
A: 

I think you want to track what are changes in your restored database comparing to that before it was restored. If so, I hope this may be helpful.

ALTER DATABASE yourdatabasename SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON); GO USE yourdatabasename; GO ALTER TABLE Person.Person ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON); GO

daydream
what will be the output of this ?? I mean, I afraid that it will not update any one of the database.. Is it going to update my database ???
Zerotoinfinite
No, it won't. It just track what has been changed between two databases
daydream
I have used this ALTER DATABASE StudentOld SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 20 DAYS, AUTO_CLEANUP = ON); GO USE studentNew; GO ALTER TABLE T_Member ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON); GOI am getting below errorA fatal scripting error occurred.Incorrect syntax was encountered while parsing GO.
Zerotoinfinite
Wait, are you trying to compare two totally different tables or are you tracking the changes of your old table? My answer only works for second issue.
daydream