tkilgallen
MIS
Looking for the basics of a SQL Talk query that references SQL. Here is what I have so far but what I am ultimately looking to do is:
Connect to SQLBase
Run this query
Write the records to a delimited text file
Disconnect
If anyone could provide a simple example of a script that contains the Login, run query, output records, disconnect I would greatly appreciate it.
Here is my current query:
SELECT DISTINCT SUM(DISTINCT REPORTS.V_CHK_VW_INFO.CHECKVIEWREGHOURS) , SUM(DISTINCT REPORTS.V_CHK_VW_INFO.CHECKVIEWOTHOURS) , SUM(DISTINCT @DECODE(REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMCODE,'01',REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMAMT,0) ) , ( SUM(DISTINCT @DECODE(REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMCODE,'02',REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMAMT,0) ) ), REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE, REPORTS.V_CHK_VW_INFO.NAME, REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT, REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE FROM REPORTS.V_CHK_VW_INFO, REPORTS.V_YTD_ACCUMULATOR WHERE (((REPORTS.V_CHK_VW_INFO.COMPANYCODE = 'ABC') AND (REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE = '2004-05-22'))) AND (REPORTS.V_CHK_VW_INFO.COMPANYCODE = REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE ) AND (REPORTS.V_CHK_VW_INFO.FILE# = REPORTS.V_YTD_ACCUMULATOR.FILE# ) AND (REPORTS.V_CHK_VW_INFO.SOCIALSECURITY# = REPORTS.V_YTD_ACCUMULATOR.SOCIALSECURITY# ) GROUP BY REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE, REPORTS.V_CHK_VW_INFO.NAME, REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE, REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT ORDER BY REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT, REPORTS.V_CHK_VW_INFO.NAME;
Connect to SQLBase
Run this query
Write the records to a delimited text file
Disconnect
If anyone could provide a simple example of a script that contains the Login, run query, output records, disconnect I would greatly appreciate it.
Here is my current query:
SELECT DISTINCT SUM(DISTINCT REPORTS.V_CHK_VW_INFO.CHECKVIEWREGHOURS) , SUM(DISTINCT REPORTS.V_CHK_VW_INFO.CHECKVIEWOTHOURS) , SUM(DISTINCT @DECODE(REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMCODE,'01',REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMAMT,0) ) , ( SUM(DISTINCT @DECODE(REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMCODE,'02',REPORTS.V_YTD_ACCUMULATOR.SPECIALACCUMAMT,0) ) ), REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE, REPORTS.V_CHK_VW_INFO.NAME, REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT, REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE FROM REPORTS.V_CHK_VW_INFO, REPORTS.V_YTD_ACCUMULATOR WHERE (((REPORTS.V_CHK_VW_INFO.COMPANYCODE = 'ABC') AND (REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE = '2004-05-22'))) AND (REPORTS.V_CHK_VW_INFO.COMPANYCODE = REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE ) AND (REPORTS.V_CHK_VW_INFO.FILE# = REPORTS.V_YTD_ACCUMULATOR.FILE# ) AND (REPORTS.V_CHK_VW_INFO.SOCIALSECURITY# = REPORTS.V_YTD_ACCUMULATOR.SOCIALSECURITY# ) GROUP BY REPORTS.V_CHK_VW_INFO.CHECKVIEWENDDATE, REPORTS.V_CHK_VW_INFO.NAME, REPORTS.V_YTD_ACCUMULATOR.COMPANYCODE, REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT ORDER BY REPORTS.V_CHK_VW_INFO.CHECKVIEWHOMEDEPT, REPORTS.V_CHK_VW_INFO.NAME;