Instant SQL Formatter

by A Rahman

Image

Awalnya aku pusing baca SQL Code program database Ms Access dari orang.  SQL Code nya panjang-panjang banget jadi susah dibaca.  Akhirnya setelah googling nemu yang nama Instant SQL Formatter disini yang berupa situs web yang mampu memformat SQl Code mudah dibaca.

Langsung contoh aja deh.  Misalnya ada SQL code Ms Access seperti ini :

//————————————–

SELECT PaymntSch_Accounting.ContractNo1, PaymntSch_Accounting.ContractNo2, PaymntSch_Accounting.ScheCd, PaymntSch_Accounting.EquipmentNo, PaymntSch_Accounting.PaymntNo, PaymntSch_Accounting.AccountingDate, PaymntSch_Accounting.MonthlyInterest, PaymntSch_Accounting.TAXInterest, PaymntSch_Accounting.TAX, PaymntSch_Accounting.VAT, PaymntSch_Accounting.Spread, PaymntSch_Accounting.Cost, PaymntSch_Accounting.Margin, PaymntSch_Accounting.AccountingBalance, PaymntSch_Accounting.AverageBalance, PaymntSch_Accounting.AllocationStatus, AllocatedStatus_M.AllocatedStatusName
FROM PaymntSch_Accounting INNER JOIN AllocatedStatus_M ON PaymntSch_Accounting.AllocationStatus = AllocatedStatus_M.AllocatedStatusCd
ORDER BY PaymntSch_Accounting.ContractNo1, PaymntSch_Accounting.ContractNo2, PaymntSch_Accounting.EquipmentNo, PaymntSch_Accounting.PaymntNo;

//—————————————-

Aku pilih jenis databasenya (pilihannya ada di sebelah kiri atas) : MS Access
Trus outputnya SQL(Text), maka setelah diformat sama program tadi (klik tombol “Format SQL”) hasilnya menjadi :

SELECT paymntsch_accounting.contractno1,
       paymntsch_accounting.contractno2,
       paymntsch_accounting.schecd,
       paymntsch_accounting.equipmentno,
       paymntsch_accounting.paymntno,
       paymntsch_accounting.accountingdate,
       paymntsch_accounting.monthlyinterest,
       paymntsch_accounting.taxinterest,
       paymntsch_accounting.tax,
       paymntsch_accounting.vat,
       paymntsch_accounting.spread,
       paymntsch_accounting.cost,
       paymntsch_accounting.margin,
       paymntsch_accounting.accountingbalance,
       paymntsch_accounting.averagebalance,
       paymntsch_accounting.allocationstatus,
       allocatedstatus_m.allocatedstatusname
FROM   paymntsch_accounting
       INNER JOIN allocatedstatus_m
               ON paymntsch_accounting.allocationstatus =
                  allocatedstatus_m.allocatedstatuscd
ORDER  BY paymntsch_accounting.contractno1,
          paymntsch_accounting.contractno2,
          paymntsch_accounting.equipmentno,
          paymntsch_accounting.paymntno; 

Asyik kan?

Dan jika aku pilih outputnya Delphi, maka menjadi seperti ini :

var1 := ''
+'SELECT paymntsch_accounting.contractno1, '
+'       paymntsch_accounting.contractno2, '
+'       paymntsch_accounting.schecd, '
+'       paymntsch_accounting.equipmentno, '
+'       paymntsch_accounting.paymntno, '
+'       paymntsch_accounting.accountingdate, '
+'       paymntsch_accounting.monthlyinterest, '
+'       paymntsch_accounting.taxinterest, '
+'       paymntsch_accounting.tax, '
+'       paymntsch_accounting.vat, '
+'       paymntsch_accounting.spread, '
+'       paymntsch_accounting.cost, '
+'       paymntsch_accounting.margin, '
+'       paymntsch_accounting.accountingbalance, '
+'       paymntsch_accounting.averagebalance, '
+'       paymntsch_accounting.allocationstatus, '
+'       allocatedstatus_m.allocatedstatusname '
+'FROM   paymntsch_accounting '
+'       INNER JOIN allocatedstatus_m '
+'               ON paymntsch_accounting.allocationstatus = '
+'                  allocatedstatus_m.allocatedstatuscd '
+'ORDER  BY paymntsch_accounting.contractno1, '
+'          paymntsch_accounting.contractno2, '
+'          paymntsch_accounting.equipmentno, '
+'          paymntsch_accounting.paymntno';

OK semoga berguna !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s