Toad World® Forums

Script comparison


#1

Hello,

I would like to use the script comparison to generate the differences between my tpx file and the database but I have a problem with it.

For tables everything works fine but I can’t find the right configuration for others objects (procedures, functions, views, …).

I explain my problem :

  • I have a procedure in my tpx file with checkbox “Generate SQL Only” checked, so I wrote all the sql code in the SQL tab. It works find and well generate the sql to create my procedure. If I change the sql in the tpx file and run the comparison it show me a difference on SQL code which is right but when I generate the script it leave the keyword “CREATE” in the SQL code so it will generate an error if I apply this script on my database.

  • I have another procedure in my tpx file with checkbox “Generate SQL Only” unchecked, so I wrote only the body of the procedure in the SQL tab. If I don’t change the sql in the tpx file and run the comparison it show me a difference on SQL code which is not correct but it will correctly change the ‘CREATE’ keyword to ‘ALTER’.

What do I have to change in my tpx file to make it work correctly ?

I attached a screenshot.

Regards.


#2

Hello,

As for the first issue - if I understand correctly, once you get the Change Script, it contains CREATE PROCEDURE statement instead of ALTER PROCEDURE? This is a problem we reproduced and created a CR for: TDM-1480. It will be fixed as soon as possible.

As for the second issue - Model Comparison also compares whitespace, comments, etc., so there may be differences that do not affect the object functionality. You can double-click the difference in comparison view and you’ll see a new window, where all differences between the SQL code of both objects are highlighted.

Regards,

Lukas


#3

Hello Lukas,

Thanks for your answer, I’ll wait for the fix.

For the second example, I already looked in the window with the differences.

I think, in this configuration, the comparison will always return differences in the SQL because it doesn’t compare the right things.

In the SQL tab of the tpx file there is not the line starting with “CREATE PROCEDURE …” which is added by TOAD (which cans be seen in the SQL Preview tab).

But when the SQL code is reversed from the database, this line is present so for TOAD there is a difference between the two SQL code which, I think, is not correct.

I attached a screenshot of the SQL differences.

Regards.


#4

Model Comparison compares the SQL code (the contents of SQL tab) of your procedure and procedure from the database. You’re correct when you say that TDM adds the CREATE statement to your local procedure when it is generated, but at the time of comparison, the comparator sees difference, meaning it is working as designed.

The solution would be to use “Generate SQL Only” option for your procedure so that its SQL tab contains the CREATE statement as well and Model Comparison detects no differences. However, you will run into the issue we discussed earlier, the final change script will contain CREATE statement for the procedure instead of ALTER statement.

Until the issue is fixed, you can ignore the CREATE statement differences in equivalent procedures by unchecking them in the comparison view. When you do that, the final change script won’t contain any statements trying to “fix” the nonexisting difference.

Regards,

Lukas


#5

It’s perfect for me, I want to use the first option so I’ll wait for the fix.

Thanks for the discussion.

Regards.


#6

Hello,

I would like to know if there’s any news about the fix.

Regards.


#7

Hello,

The issue is fixed, the fix will be implemented in the next Beta version of TDM.

Regards,

Lukas


#8

Hello,

Can tell me when the next beta version will be released please ?

Regards.


#9

Hello again,

The next Beta version will be released probably sometime during next week.

Regards,

Lukas


#10

Ok thanks for the answer.

Regards.