RE: (Urgent) Create many txt files from tables with DTS Package



Thanks for your advice
when i run this script the error show :

Error Source : Microsoft Data Transformation Services (DTS) Package

Error Description :Error Code :0
Error Source=Microsoft VBScript runtime error
Error Description: Object required:'DTSGlobalVariabels(...).Value'

Error on line 9

the script i run is

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

' BuildMsgBoxString - Task Script
Option Explicit

Function Main()

Dim oRS
Set oRS = DTSGlobalVariables("RSTables").Value

' Get row value and add it to the MsgBoxString global variable
DTSGlobalVariables("MsgBoxString").Value = _
DTSGlobalVariables("MsgBoxString").Value & _
oRS.Fields(0).Value & vbCrLf

' Move to the next row in preparation for loop iteration
oRS.MoveNext

Set oRS = Nothing

Main = DTSTaskExecResult_Success
End Function


"Allan Mitchell" wrote:

> Ahhhh
>
> This is certainly obtainable yes.
>
> Right.
>
>
> Grab the distinct list of Orgnames in your data. Assign to a GV rowset
>
> How to loop through a global variable Rowset
> (http://www.sqldts.com/default.aspx?298)
>
> You will loop over this
>
> On each iteration of the loop you need to fire a DataPump task .You now
> need on each iteration of the loop to change the SourceSQLStatement of
> the DataPump task using the value stored in the rowset
>
>
> Global Variables and SQL statements in DTS
> (http://www.sqldts.com/default.aspx?205)
>
>
> You also need to change the name of the connection that pertains to the
> destination text file on each iteration
>
>
> How can I change the filename for a text file connection?
> (http://www.sqldts.com/default.aspx?200)
>
>
>
> Once you have all this together you should have what you want.
>
> Allan
>
>
>
>
> "Andry Cahyadi" <AndryCahyadi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message news:48CDC379-F94F-446A-8CC3-457440AD5143@xxxxxxxxxxxxx:
>
> > This is my Table
> >
> > EmpId EmpName OrgName
> > ------------------------------------------------------------------------
> > -----------------
> > D.50.96.0013 I Putu Eka Arsana Bengkel & Kendaraan BI
> > D.12.03.0085 Agus Chotib Yahya Bengkel & Kendaraan BN
> > D.12.04.0004 L.Kristiyanto Eka Yanuar Bengkel & Kendaraan BN
> > D.10.02.0020 Jumaedi Bengkel & Kendaraan DK
> > D.10.04.0025 Herdi Bengkel & Kendaraan DK
> > D.10.97.0002 Rubiyatun Bengkel & Kendaraan DK
> > D.10.98.0030 Antonius Lei Boro Bengkel & Kendaraan DK
> > D.10.99.0004 Nasokhi Bengkel & Kendaraan DK
> > D.20.01.0063 Aam Nurakhman Bengkel & Kendaraan JB
> > D.20.96.0012 Cucun Rukmana Bengkel & Kendaraan JB
> > D.40.02.0302 Heru Purnawan Bengkel & Kendaraan JI
> > D.40.97.0029 Tontowi Jauhari Bengkel & Kendaraan JI
> > D.30.02.0114 Amin Sustiyo Mulyo Bengkel & Kendaraan JT
> > D.30.91.0003 Agus Supriyanto Bengkel & Kendaraan JT
> > D.30.99.0007 Much. Asrul Bahrudin Bengkel & Kendaraan JT
> > D.11.03.0039 Samino Bengkel & Kendaraan RD
> > D.11.03.0040 Utari Bengkel & Kendaraan RD
> > D.11.97.0004 Nana Suryana Bengkel & Kendaraan RD
> > D.90.70.0001 Hamid Djojonegoro BOARD OF COMMISSIONER
> > D.90.70.0002 Husain Djojonegoro BOARD OF COMMISSIONER
> > D.90.70.0003 Pudjiono Djojonegoro BOARD OF COMMISSIONER
> > D.20.05.0040 Syaiful Bakhri Sanusi Business BD
> > D.11.05.0003 Lim Robbet Business D190
> > D.90.02.0014 Hasan Lim Business D190
> > D.91.04.0029 Derrick Surya Saputra Business D190
> > D.20.02.0220 Agus Setianto Business PSL
> > D.50.04.0071 Putu Supertama Checker BI
> > D.50.91.0001 Tan Wie Piauw Checker BI
> > D.93.04.0007 I Nyoman Muliartha Checker BI
> > D.10.80.0001 Bun Kim Nyan Checker BN
> > -------
> > -------
> > -------
> > -------
> >
> > I want to create textfiles according to ORGNAME from that table.The
> > Result i
> > want to is :
> > 1. txtfile name : Bengkel&Kendraan.txt
> > Details :
> > D.50.96.0013 I Putu Eka Arsana
> > D.12.03.0085 Agus Chotib Yahya
> > D.12.04.0004 L.Kristiyanto Eka Yanuar
> > D.10.02.0020 Jumaedi
> > D.10.04.0025 Herdi
> > D.10.97.0002 Rubiyatun
> > D.10.98.0030 Antonius Lei Boro
> > D.10.99.0004 Nasokhi
> > D.20.01.0063 Aam Nurakhman
> > D.20.96.0012 Cucun Rukmana
> > D.40.02.0302 Heru Purnawan
> > D.40.97.0029 Tontowi Jauhari
> > D.30.02.0114 Amin Sustiyo Mulyo
> > D.30.91.0003 Agus Supriyanto
> > D.30.99.0007 Much. Asrul Bahrudin
> > D.11.03.0039 Samino
> > D.11.03.0040 Utari
> > D.11.97.0004 Nana Suryana
> >
> > 2.txt filename : BOARDOFCOM.txt
> > details :
> > D.90.70.0001 Hamid Djojonegoro
> > D.90.70.0002 Husain Djojonegoro
> > D.90.70.0003 Pudjiono Djojonegoro
> >
> > 3.txt filename: Busines.txt
> > details :
> > D.20.05.0040 Syaiful Bakhri Sanusi
> > D.11.05.0003 Lim Robbet
> > D.90.02.0014 Hasan Lim
> > D.91.04.0029 Derrick Surya Saputra
> > D.20.02.0220 Agus Setianto
> >
> > 4. txt filename : Checker.txt
> > details :
> > D.50.04.0071 Putu Supertama
> > D.50.91.0001 Tan Wie Piauw
> > D.93.04.0007 I Nyoman Muliartha
> > D.10.80.0001 Bun Kim Nyan
> >
> > 5. etc...
> >
> > i want to create that txtfiles automatic create everyday inf my folder,
> > because the table always update everyday too. Can u help me?
> >
> >
> >
> >
> >
> > "Allan Mitchell" wrote:
> >
> >
> > > So what are you saying?
> > >
> > > You want to take 1 table and produce n text files of the same data?
> > >
> > > You could do that using a loop and change the name of the file on each
> > > iteration.
> > >
> > > Let us know if I have the requirement correct. If not can you give us
> > > some more details?
> > >
> > >
> > > Allan
> > >
> > >
> > >
> > >
> > > "Andry Cahyadi" <AndryCahyadi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> > > message news:6705FFCC-E6FC-4C91-9071-2749776DDA43@xxxxxxxxxxxxx:
> > >
> >
> > > > that's just example, i want to make many txt files, not 2 txt
> > files.from
> > > > 1 or
> > > > 2 table into many txt files.
> > >
> >
> > >
>
>
.



Relevant Pages

  • RE: (Urgent) Create many txt files from tables with DTS Package
    ... ' Move to the next row in preparation for loop iteration ...
    (microsoft.public.sqlserver.dts)
  • Re: Report in FM 6 or 7
    ... achieve this report format will have to be done via scripting. ... but they will simplify the script and Sort Order. ... End Loop ... The normal 'Dancer' field is used so that if there are more than one ...
    (comp.databases.filemaker)
  • Re: recreate database script not work
    ... I got a script which is supposed to regenerate database systax. ... REM gen_dbse_9.sql ... end loop; ...
    (comp.databases.oracle.server)
  • Re: Loop Problem (At Least I think)
    ... If there are no images matching the product ... "" Then" statement (the one below the loop, outside of it), is this just ... >> script to finish. ... > 2) Read the database table and acess the dictionary object for the ...
    (microsoft.public.scripting.vbscript)
  • Re: How to set up a global variable in a sub-routine?
    ... the 'global variables' are more like constants ... ... single script, I need a way to tell it only once where the file is and ... So, if you construct a loop with a loop variable, you ... >programmers avoid global variables completely. ...
    (perl.beginners)

Loading