Validating database schema
primary keys, unique constraints, foreign keys, etc) I've written a set of queries for exactly this purpose on SQL Server for a past job - it worked well to identify differences.Many of the queries were using LEFT JOINs with IS NULL to check for the absence of expected items, others were comparing things like column types or constraint names. I found this small and free tool that fits most of my needs.I wrote a simple app that validates and XML document using an XSD schema just to show you how to write the code. You’ll first instantiate an XMLSchema object and add to it the XSD schema file that you already have.When you call the Add method, the first parameter is the namespace that your XML document uses.
We can recommend you a reliable SQL comparison tool that offer 3 time’s faster comparison and synchronization of table data in your SQL Server databases.
On my current gig this was no problem at all, as the DBA's here were already using it.
The basic methodology for using these tools is to maintain a reference script that builds the database and keep this in version control.
You’ll need to get a copy of MSXML 4.0 and install it.
Assuming you already have the schema and the XML document, all you need now is a few lines of code to validate.
Search for validating database schema:
What makes it even more interesting is that, besides user validation, it can be used to define database schemas as well.