Home » DbVisualizer Forums » DbVisualizer » DbVisualizer - Support

Thread: @export and drop before create

This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 5 - Pages: 1 - Last Post: Feb 25, 2012 2:47 AM Last Post By: Hans Bergsten
panasiuk

Posts: 3
Registered: 02/23/12
@export and drop before create
Posted: Feb 23, 2012 10:16 PM
 
   thread.click_reply Reply
Is possible during @export to generate drop table, before create table?

My example work:

@export on;
@export set filename="table1.sql" format="sql" appendFile="clear" SqlIncludeCreateDDL="true";
select * from table1;

but i would like to have in table1.sql:

drop table table1;
cerate table1 ...
insert into table1 (...
...

Thank you

Hans Bergsten


Posts: 1,565
Registered: 10/11/06
Re: @export and drop before create
Posted: Feb 24, 2012 2:41 AM    global.in_response_to.tooltip in response to: panasiuk
Helpful
   thread.click_reply Reply
Hi,

You can use the @ddl command to accomplish this:

@export on;
@export set filename="table1.sql" format="sql" appendFile="clear";

@ddl table="table1" drop="true";

select * from table1;

@export off;

Best Regards,
Hans
panasiuk

Posts: 3
Registered: 02/23/12
Re: @export and drop before create
Posted: Feb 24, 2012 5:53 PM    global.in_response_to.tooltip in response to: Hans Bergsten
 
   thread.click_reply Reply
That's it.

Thank you!
panasiuk

Posts: 3
Registered: 02/23/12
Re: @export and drop before create
Posted: Feb 24, 2012 6:07 PM    global.in_response_to.tooltip in response to: Hans Bergsten
 
   thread.click_reply Reply
Thank you for your answer. It's helpful. Additionally, I have idea if it is possible something like this:

$tab1$ = "table1";

@export on;
@export set filename=$tab1$ format="sql" appendFile="clear";

@ddl table=$tab1$ drop="true";

select * from t$tab1$;

@export off;
Hans Bergsten


Posts: 1,565
Registered: 10/11/06
Re: @export and drop before create
Posted: Feb 25, 2012 2:45 AM    global.in_response_to.tooltip in response to: panasiuk
 
   thread.click_reply Reply
Hi,

You can use DbVisualizer variables in the script and be prompted for the name of the table when you execute it. Please see the Users Guide for syntax:

http://www.dbvis.com/products/dbvis/doc/main/doc/ug/sqlCommander/sqlCommander.html#mozTocId803385

Give it a try and let us know if you have more questions.

Best Regards,
Hans
Hans Bergsten


Posts: 1,565
Registered: 10/11/06
Re: @export and drop before create
Posted: Feb 25, 2012 2:47 AM    global.in_response_to.tooltip in response to: panasiuk
 
   thread.click_reply Reply
Hi,

Additionally, if you want to export many tables from a schema, please note that you can use the Schema Export feature instead of writing your own script:

http://www.dbvis.com/products/dbvis/doc/main/doc/ug/exportImport/exportImport.html

Best Regards,
Hans

Point your RSS reader here for a feed of the latest messages in all forums