Is there something similar to Diff for SQL Server 2008

kasiencja
kasiencja used Ask the Experts™
on
Hi,

I have a huge database and an even bigger spaghetti code that I'm supposed to learn.  I was wondering if there is some kind of a tool or a way to see what tables were affected and what was changed after a user action.

Thanks,
Kathryn
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AneeshDatabase Consultant
Top Expert 2009

Commented:
Hello kasiencja,

you can debug the code, that will give you an idea of whats happening during the execution, eventhough it didnt give you the contents you are inserting (unless u have a select statement after the insert ). it will be pretty handy



Regards,

Aneesh
You may also consider looking at SQL Server Profiler, with some configuration this will show what queries are running and the associated parameter values.


Regards
Test your restores, not your backups...
Top Expert 2016
Commented:
Quest's TOAD utility has the ability to do a DIFF-like data compare between two tables, but it can't scan a whole database and tell you which tables have changed.  You would have to copy off the tables that you are interested in, run the code, and then compare the current live tables to the saved copy one at a time.

Not terribly efficient and may be hard to follow, but since that was your original question I figured I'd reply to that.  I'm not sure if the freeware version has this capability in it or only the commercial product.  It's a good tool for working with SQL Server or Oracle, but isn't cheap.

http://www.quest.com/toad-for-sql-server/
http://www.toadsoft.com/toadsqlserver/toad_sqlserver.htm

ApexSQL Diff is another tool like this, but I don't have any experience with it.

http://www.apexsql.com/sql_tools_diff.asp

~bp
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
I've also just installed a package from Redgate, which looks quite promising.  It compares databases including data changes.  Testing it now.
AneeshDatabase Consultant
Top Expert 2009

Commented:
i dont really understand the question, i thought your intention was to learn the code and i think i did answer the question, correct me if i am wrong

Author

Commented:
I'm sorry if I didn't make the question clear.  What I wanted to find out was if there is a way to compare before and after database snapshots.  After would be when a user action happens, this way I can easily figure out which tables are used where, instead of going through thousands of lines of code.

Regards,
Kasia
AneeshDatabase Consultant
Top Expert 2009

Commented:
that makes sense :) in future make sure that you clearly specify the requirements

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial