DbVisualizer - SQL Commander

标签(空格分隔): DbVisualizer SQL


Reference

DbVisualizer - SQL Commander


@export- exportresult sets to file

The @export commands are used to declare that any result sets from the SQL statements that follows should be written to a file instead of being presented in the DbVisualizer tool. This is really useful, since it enables dumping very large tables to a file for later processing or, for example, to perform backups. The following commands are used to control the export:

  • @export on
    Defines that the SQL statements that follows will be exported rather then being presented in DbVisualizer
  • @export set parm1="value1" parm2="value2"
    The set command is used to customize the export process. Check the table below for the complete set of parameters.
  • @export off
    Defines that SQL statements that follows will be handled the normal way, i.e., the result sets are presented in the DbVisualizer tool

These parameters are supported:

ParameterDefaultValid Values
AppendFilefalsetrue,false, clear
BinaryFileDir Directory path for data files when BinaryFormatis set to File
BinaryFormatDon'tExportDon'tExport, Size, Value, Hex, Base64, File
BooleanFalseFormatfalsefalse, no, 0, off
BooleanTrueFormattruetrue, yes, 1, on
CLOBFileDir Directory path for data files when CLOBFormat isset to File
CLOBFormatValueDon't Export, Size, Value, File
CsvColumnDelimiter\t(TAB) 
CsvIncludeColumnHeadertruetrue,false
CsvIncludeSQLCommandfalsetrue,false
CvsRemoveNewlinesfalsetrue, false
CsvRowCommentIdentifier  
CsvRowDelimiter\n\n(UNIX/Linux/Mac OS X), \r\n (Windows)
DateFormatyyyy-MM-ddSeevalid formats in ToolProperties document
DecimalNumberFormatUnformattedSeevalid formats in ToolProperties document
DestinationFileFile
EncodingUTF-8 
ExcelFileFormatxlsxls (Binary Excel) or xlsx(Excel 2007)
ExcelIncludeColumnHeadertruetrue, false
ExcelIncludeSQLCommandfalse 
ExcelIntroText Any description
ExcelTextOnlyfalsetrue, false
ExcelTitle Any title
FilenameREQUIRED** **
FormatCSVCSV,HTML, XML, SQL, XLS
HtmlIncludeSQLCommandfalsetrue,false
HtmlIntroText Any description
HtmlTitle Any title
NumberFormatUnformattedSeevalid formats in ToolProperties document
QuoteDuplicateEmbeddedtruetrue, false (quote char is the same asQuoteTextData)
QuoteTextDataNoneNone,Single, Double
Settings  
ShowNullAs(null) 
SqlIncludeCreateDDLfalsetrue, false
SqlIncludeSQLCommandfalsetrue,false
SqlRowCommentIdentifier-- 
SqlSeparator; 
TableName Can be set if DbVisualizer cannot determine the value for the${dbvis-object} variable
TimeFormatHH:mm:ssSeevalid formats in ToolProperties document
TimeStampFormatyyyy-MM-dd HH:mm:ss.SSSSSSSee valid formats in Tool Propertiesdocument
XmlIncludeSQLCommandfalsetrue, false
XmlIntroText  
XmlStyleDbVisualizerDbVisualizer, XmlDataSet, FlatXmlDataSet

Example1: @export withminimum setup

The following example shows the minimum commands to export a result set.

The result set produced by the select * from Orders will be exported to the C:\Backups\Orders.csv file, using the default settings.

@export on;
@export set filename="c:\Backups\Orders.csv";
select * from Orders;

Example2: @export withautomatic table name to file name mapping

This example shows how to make the filename the same as the table name in the select statement. The example also shows several select statements. Each will be exported in the SQL format. Since the filename is defined to be automatically set, this means that there will be one file per result set and each file is named by the name of its table.

There must be only onetable name in a select statement in order to automatically set thefilename with the ${dbvis-object}$ variable, i.e if the select joinsfrom several tables or pseudo tablesare used, you must explicitly name the file.

The ${dbvis-object}$ variable is not substituted with atable name if using the AppendFile="true/clear" parameter.

@export on;
@export set filename="c:\Backups\${dbvis-object}$" format="sql";
select * from Orders;
select * from Products;
select * from Transactions;

Example3: @export all resultsets into a single file

This example shows how all result sets can be exported to a single file. The AppendFile parameter supports the following values.

  • true
    The following result sets will all be exported to
    a single file
  • false
    Turn off the append processing
  • clear
    Same as the true
    value but this will in addition clear the file before the first result set is exported
@export on;
@export set filename="c:\Backups\alltables.sql" appendfile="clear" format="sql";
select * from Orders;
select * from Products;
select * from Transactions;

Example4: @export usingpredefined settings

The Export dialogs let you save export settings to a file for later use. Such an export settings file can be referenced in the @export set command.

@export on;
@export set settings="c:\tmp\htmlsettings.xml" filename="c:\Backups\${dbvis-object}$";
select * from Orders;
select * from Products;
select * from Transactions;

The example shows that all settings will be read from the c:\tmp\htmlsettings.xml file.



作者:lumicinta
链接:https://www.jianshu.com/p/d89729b083fa
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值