Search the web
Sign In
New User? Sign Up
VisualBasic_Official · Visual Basic . VB.net . VBS . ASP.net
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Write to Txt file from SQL Statement   Message List  
Reply | Forward Message #9467 of 9531 |
I have a need to run a sql statement against DB2 and based on the results of
that query write the output to a TXT file.

SQL Looks like this.

=============-----------------===================------------------

SELECT
SAPDW.DW_CALENDAR.sales_cur_date,
SAPDW.DW_BILLTO.BILLTO_NBR,
SAPDW.DW_BILLTO.BILLTO_NAME,
SAPDW.DW_BILLTO.BILLTO_COUNTRY_DESC,
SAPDW.DW_BILLTO.BILLTO_SALES_CHANNEL_CODE,
SAPDW.DW_BILLTO.SUB_CHANNEL_CODE,
SAPDW.DW_COMPANY.COMPANY_CODE || ' - ' || SAPDW.DW_COMPANY.COMPANY_DESC
FROM
SAPDW.DW_CALENDAR,
SAPDW.DW_BILLTO,
SAPDW.DW_COMPANY,
SAPDW.DW_LINE_TYPE,
SAPDW.DW_SALES,
SAPDW.DW_CURRENCY_RATE CURRENCY_RATE_BUS_DAYS
WHERE
( SAPDW.DW_SALES.LINE_TYPE_SK=SAPDW.DW_LINE_TYPE.LINE_TYPE_SK )
AND ( SAPDW.DW_CALENDAR.DATE_KEY=SAPDW.DW_SALES.GL_DATE_SK )
AND ( SAPDW.DW_SALES.BILLTO_SK=SAPDW.DW_BILLTO.BILLTO_SK )
AND ( SAPDW.DW_BILLTO.BILLTO_RECORD = 'Y' )
AND ( SAPDW.DW_COMPANY.COMPANY_SK=SAPDW.DW_SALES.COMPANY_SK )
AND ( CURRENCY_RATE_BUS_DAYS.CURRENCY_TYPE='EURXYTD' AND
SAPDW.DW_SALES.COMPANY_CURRENCY=CURRENCY_RATE_BUS_DAYS.CURRENCY_FROM
)
AND ( SAPDW.DW_CALENDAR.SALES_CUR_YEAR=CURRENCY_RATE_BUS_DAYS.FISCAL_YR )
AND ( SAPDW.DW_CALENDAR.SALES_CUR_MONTH=CURRENCY_RATE_BUS_DAYS.MONTH_NBR )
AND
(
SAPDW.DW_BILLTO.BILLTO_NBR <> 0
AND
SAPDW.DW_BILLTO.SUB_CHANNEL_CODE In ( '10','20','30' )
AND
SAPDW.DW_BILLTO.CUSTOMER_GROUP5_CODE = ' '
AND
SAPDW.DW_COMPANY.COMPANY_CODE = 'OPTR'
AND
SAPDW.DW_LINE_TYPE.LINE_TYPE_CODE In ( 'GR','ZR','DR','CD','AR' )
)

=============-----------------===================------------------

How would I go about writing the results to a text file?




Mon Jul 13, 2009 8:12 pm

joefonseca79
Offline Offline
Send Email Send Email

Forward
Message #9467 of 9531 |
Expand Messages Author Sort by Date

I have a need to run a sql statement against DB2 and based on the results of that query write the output to a TXT file. SQL Looks like this. ...
Joe
joefonseca79
Offline Send Email
Jul 14, 2009
7:51 pm

I haven't work with DB2, so if you're trying to write a text file directly from the Database, you should look at the native DB2 utility. However, you you read...
mgaft1
Online Now
Jul 14, 2009
8:25 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help