Toad World® Forums

Show/unshow schema name in ALTER script


#1

Add columns|Show SQL and Alter selected Table|Show SQL always include schema name however Schema name is off at SB|Tables RHS|Script|Options. I don’t know this option should be control this feature (to include schema name or not) but I always have to delete the schema name manually in my script. Can you provide a solution for it, please? Thank you.


#2

This is the same with Create Constraint|Show SQL, the statement also contains the schema name.

For constraints the statement termination (:wink: is missing from the last line. I think this was an issue also in 12.6 and 12.7.


#3

The script options are only intended to control the options on the script tab.

I will add the semicolon to the create constraint dialog.

I am hesitant to add an option to include/exclude the schema name in the “show sql” output of the create/alter dialogs. And I think if I used the one on the script tab, most people wouldn’t realize it. One option would be to automatically exclude the schema name if it matches the login name, but I think that will just cause some user to eventually ask me to add the schema name back in.

Right now, if you clear the schema name in the create/alter dialog, you’ll either get a “schema name required” prompt, or you’ll get a statement with a missing schema (such as “alter table .table_name add constraint…”). But I would be OK with making a change such that if you leave the schema name blank, Toad will produce a valid statement without the schema name.


#4

John,

Your change should be OK if you go from SB LHS|Alter selected Tables or Create Table. But I’ve added the columns from SB RHS|Columns|+ sign on toolbar, where doesn’t exist a schema name drop-down. Don’t you think a global option would be more consistent to solve this referenced schema name in create/alter statements?

The reason I asked this modification is the schema names are usually differ in the dev and prod databases. If I create an installation script during the development cycle for the prod database I have to manually erase the schema name from the generated statements.

T.


#5

I’m just afraid that such an option is going to cause problems for some people (forgetting that the “exclude schema” option is enabled, and not noticing it in the script).

Maybe a dropdown on the “show sql” button would be better. The button would continue to work as it does now, but a dropdown on that button would have a “show SQL without schema” menu item.


#6

That’s will be a great option for me. Thanks your solution.


#7

Done for next beta. It should be in all of the schema-related create/alter dialogs.


#8

John,

This feature has disappeared in the latest beta. Would you be so kind as to check it? Thank you.


#9

I got some complaints about how it looked. Right-click on the show sql button.


#10

Oh, I got it. Thank you.