Showing posts with label compare. Show all posts
Showing posts with label compare. Show all posts

Wednesday, March 21, 2012

Generating Scripts at the database level

Hi All,

I require to compare two database structures.This is what I went for:

I generated scripts (right click on the database --> All Tasks--> Generate Scripts) for all tables in the two given databases and compared them.

The problem is that the order of the tables in the generated scripts are different. Can I control this order by any possible means?

Thanks in advance.

I do not know of a way offhand via the generate scripts wizard, however you can manually generate a script for each table, copy them to the clipboard, and then paste them into the desired order into a new query window.

hope this helps,

derek

|||

You can 'cut and paste' the script files using your editor (Visual Notepad, for example).

Otherwise, you cannot 'control' the order of elements in the script that the scripting wizard creates.

Generating reports from flat files

Hi

I got two text files with data.I got to compare two files and if there is any inconsistancy between two files I need to dispaly as a report using sql reporting services.I do not know how to do that?

Any source code or suggestion.

Thanx in advance

What is the format of the data files? By "comparing", is this line-for-line, character-for-character, or is the structure of the files regular data rows?

>L<

|||line-for-line|||

Different people will give you different advice about the best thing to do here, depending on which environment they are comfortable working in. All the different types of advice will boil down to the following steps:

consume both files into the same structure, which has one row for each row of the file(s).

It doesn't matter whether this is an XML structure or a database table, or how the data gets into that structure, that is a detail of implementation we can discuss when you tell us more about your background. You could use an SSIS package, read the files in CLR code a line at a time, etc.

Here are some thoughts about exactly what you should store:
I think it would be useful to have an integer value representing line number in this case as well, for reporting purposes.
Make some determinations about what represents a significant change between the files. This will make some differences in how you store the rows. For example: do you omit "whitespace" lines -- can they be safely skipped? Suppose that (for instance) the two files are identical but row 80 has an extra carriage return in one file. Does that mean that all the rows from 81 down are counted as different from each other, working on line number basis only? Or are they the same, even though the line numbers are offset by 1? is punctuation significant? Is case-sensitivity?
|||

Thanx for you advice.

I have done like this but how will you give the xml structure generated from flat files to the reporting engine.

Any idea

Thanx

|||

You can use the XML files as a datasource directly, if you design the XML to look like ADO dataset XML.

You can also have a "real" database consume the XML (regardless of its schema) and then do the report from there.

What does your XML look like?

>L<