creating excel from sqlsqliquery.com/datastore/iqueryexcel.pdftransforming sql to excel using iquery...

13
Creating Excel from SQL Transforming SQL to Excel on IBM i SQLiQuery.com iQ © 2016 Cozzi Productions, Inc. with Bob Cozzi [email protected] Twitter: @bobcozzi

Upload: others

Post on 13-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

CreatingExcelfromSQLTransformingSQLtoExcelonIBMi

SQLiQuery.com

iQ©2016CozziProductions,Inc.

with

[email protected]:@bobcozzi

Page 2: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

DownloadthisPresentation

Page 3: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

• WeborCommandLineSQLprocessor

• PowerfulScriptingToolsupportingIBMi DB2SQL• RunanySQLcommand

• SendSQLSELECTresultstoyourchoiceofoutputformats• CSV,Sylk,JSON,Excel,XML,PDF,Print,Display,etc.

SQL iQueryPowerful Database Query and SQL Scripting for IBM i

© Cozzi Productions, Inc.www.SQLiQuery.com

Page 4: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

SQLiQuery.com

iQResultsareblah

TXT

{JSON}CSV

,

Your Data with SQL iQueryYour Data

*WriteoneSQLstatement,outputtoanysupportedformat.

SQL iQuerySQL Processing and Scripting for IBM i

©2016CozziProductions,Inc.

*WriteOneandDone!

Page 5: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

RunSQLusingiQuery

• RunSQLfrommanyinterfaces• CommandEntry• CL• MenuOptions• Batch• JobScheduler• YourownWebPage

• Outputtoagrowinglistofmediaformats• Excel,CSV,JSON,HTML,XML,PDF,Print,Display,Db2table,etc.

• EmailingofResultsisavailable• SaveandRecalloftenusedSQLstatements

• AsSourceFileMembers• AsIFSTextFiles

• UsediQueryScripttoenhancesavedSQL

Page 6: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

RUNiQRY BasicResults- Display

RUNiQRY SQL('SELECT * FROM QIWS/QCUSTCDT')

Page 7: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

RUNiQRY BasicResults- Printed

RUNiQRY SQL('SELECT * FROM QIWS/QCUSTCDT') OUTPUT(*PRINT)

WRKSPLF

Page 8: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

TransformingSQLtoExcelusingiQuery

• SQLtoExcelisjustaseasyasstandardoutput,displayorprint.• TheOUTPUTparameterissimplysettoOUTPUT(*EXCEL)

• ThreeExcelformatsaresupported1. ClassicCSV(Commaseparatedvalues)2. SyLK (MultiplanSymbolicLink)(originalExcelformat)3. .XLS(NativeExcelformatinternally:SpreadsheetML format)

• StandardOUTPUT(*EXCEL)formatisusuallygoodenough• Modifications/Customizationsaresupported• UseSQLiQueryScripttoset/savemoreExcelpropertieswhenneeded

Page 9: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

SQLtoExcelusingiQuery's RUNiQRY Command

RUNiQRY SQL('SELECT * FROM QIWS/QCUSTCDT') OUTPUT(*EXCEL)EMAIL([email protected]) SUBJECT('SQL to Excel Demo')

Page 10: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

CustomizingSQLtoExcelTransformation

• Let'saddcolumntotalstothefinaltwocolumnsintheresultset• Columns10and11(BALDUEandCDTDUE)willbetotaled

• TheCOLTOTALparametersupports• Relativecolumnnumber(10and11)• Columnnames(BALDUE,CDTDUE)

• Iprefertouserelativecolumnnumberswhenexpressionsareusedinthestatement,otherwiseItendtousecolumnnames

• Toaddcolumntotals:• AddtheCOLTOTAL(BALDUECDTDUE)parameterisaddedtotheRUNiQRYcommand

Page 11: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

SQLtoExcelusingiQuery's RUNiQRY Command

RUNiQRY SQL('SELECT * FROM QIWS/QCUSTCDT') OUTPUT(*EXCEL)EMAIL([email protected]) SUBJECT('SQL to Excel Demo')COLTOTAL(BALDUE CDTDUE)

Page 12: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

SQLiQuery.com

iQResultsareblah

TXT

{JSON}CSV

,

Your Data with SQL iQueryYour Data

*WriteoneSQLstatement,outputtoanysupportedformat.

SQL iQueryTransforming SQL results into the formats your users need

©2016CozziProductions,Inc.

*WriteOneandDone!

Page 13: Creating Excel from SQLsqliquery.com/datastore/iQueryExcel.pdfTransforming SQL to Excel using iQuery •SQL to Excel is just as easy as standard output, display or print. •The OUTPUT

[email protected]

SQLiQuery.com

iQ