DbVisualizer使用脚本导出数据到excel 10
找到的脚本
一、使用场景
由于项目的特殊性,要求提取各种不固定的数据清单,主要场景综述如下:
1、数据清单要求以.xls的形式存储
2、数据清单的提数SQL脚本相对复杂
3、大数据量存储,不可能将数据查询出来,再导出到文件中
二、解决方式
项目组常用工具为DbVisualizer,所以使用此工具可直接导出指定SQL脚本查询结果,并以.xls形式保存,
无须再先查询出数据结果,再导出数据到文件中。
三、使用脚本
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@export on;
@export set AppendFile="false"
BinaryFileDir=""
BinaryFormat="Value"
BooleanFalseFormat="false"
BooleanTrueFormat="true"
CLOBFileDir=""
CLOBFormat="Value"
ClipboardName=""
CsvColumnDelimiter="\t"
CsvIncludeColumnHeader="true"
CsvIncludeSQLCommand="Don't Include"
CsvRemoveNewlines="false"
CsvRowCommentIdentifier=""
CsvRowDelimiter="\n"
DateFormat="yyyy-MM-dd"
DecimalNumberFormat="Unformatted"
Destination="File"
Encoding="GBK"
ExcelFileFormat="Binary Excel (xls)"
ExcelIncludeColumnHeader="true"
ExcelIncludeSQLCommand="false"
ExcelIntroText=""
ExcelTextOnly="false"
ExcelTitle=""
Filename="C:\导出数据存储的文件名.xls"
Format="XLS"
HtmlIncludeSQLCommand="false"
HtmlIntroText=""
HtmlTitle=""
ImageHeight=""
ImageWidth=""
NumberFormat="Unformatted"
Orientation="Portrait"
QuoteDuplicateEmbedded="true"
QuoteTextData="None"
RowCount="10"
ShowNullAs="(null)"
SqlBlockBeginDelim="--/"
SqlBlockEndDelim="/"
SqlCommanderEditor="New Editor"
SqlIncludeCreateDDL="false"
SqlIncludeSQLCommand="Don't Include"
SqlRowCommentIdentifier="--"
SqlSeparator=";"
TableName="fzacc"
TimeFormat="HH:mm:ss"
TimeStampFormat="yyyy-MM-dd HH:mm:ss"
TxtIncludeColumnHeader="true"
TxtIncludeSQLCommand="Don't Include"
TxtRemoveNewLines="false"
TxtRowDelimiter="\n"
TxtSpacesBetweenColumns="1"
XmlIncludeSQLCommand="false"
XmlIntroText=""
XmlStyle="DbVisualizer";
-- 执行的SQL脚本 -- START
select first 50 * from tableName ;
-- 执行的SQL脚本 -- END
@export off; 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏10(财富值+成长值)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@export on;
@export set AppendFile="false"
BinaryFileDir=""
BinaryFormat="Value"
BooleanFalseFormat="false"
BooleanTrueFormat="true"
CLOBFileDir=""
CLOBFormat="Value"
ClipboardName=""
CsvColumnDelimiter="\t"
CsvIncludeColumnHeader="true"
CsvIncludeSQLCommand="Don't Include"
CsvRemoveNewlines="false"
CsvRowCommentIdentifier=""
CsvRowDelimiter="\n"
DateFormat="yyyy-MM-dd"
DecimalNumberFormat="Unformatted"
Destination="File"
Encoding="GBK"
ExcelFileFormat="Binary Excel (xls)"
ExcelIncludeColumnHeader="true"
ExcelIncludeSQLCommand="false"
ExcelIntroText=""
ExcelTextOnly="false"
ExcelTitle=""
Filename="C:\导出数据存储的文件名.xls"
Format="XLS"
HtmlIncludeSQLCommand="false"
HtmlIntroText=""
HtmlTitle=""
ImageHeight=""
ImageWidth=""
NumberFormat="Unformatted"
Orientation="Portrait"
QuoteDuplicateEmbedded="true"
QuoteTextData="None"
RowCount="10"
ShowNullAs="(null)"
SqlBlockBeginDelim="--/"
SqlBlockEndDelim="/"
SqlCommanderEditor="New Editor"
SqlIncludeCreateDDL="false"
SqlIncludeSQLCommand="Don't Include"
SqlRowCommentIdentifier="--"
SqlSeparator=";"
TableName="fzacc"
TimeFormat="HH:mm:ss"
TimeStampFormat="yyyy-MM-dd HH:mm:ss"
TxtIncludeColumnHeader="true"
TxtIncludeSQLCommand="Don't Include"
TxtRemoveNewLines="false"
TxtRowDelimiter="\n"
TxtSpacesBetweenColumns="1"
XmlIncludeSQLCommand="false"
XmlIntroText=""
XmlStyle="DbVisualizer";
-- 执行的SQL脚本 -- START
select first 50 * from tableName ;
-- 执行的SQL脚本 -- END
@export off;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------