dbTalk Databases Forums  

Open/Save TXT file from DTS Package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Open/Save TXT file from DTS Package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
martino rivaplata
 
Posts: n/a

Default Open/Save TXT file from DTS Package - 01-13-2004 , 08:06 PM






Hello,

Is it possible to have within a DTS package a task that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied (column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 01:25 AM






What do you want to do with the text file?

Why OPEN/CLOSE?

Yes it is possible just curious as to whther there is a different way to do
what you want.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,

Is it possible to have within a DTS package a task that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied (column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !




Reply With Quote
  #3  
Old   
martino rivaplata
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 10:23 AM



Hi Allan,

Every week/month a text file is placed in a network
directory, this text file has some work to do before it
gets ready to be copied into A SQL Server Tbl.

First, the first two lines need to be deleted, second, at
the third line, the last header column name need to be
changed to "Cur Cod2" and lastly save the file.

If i can manage to do these tasks within a DTS package,
then the only thing left to do in the package will be
just to copy (column to column) to the SQL Srvr Tbl.

I hope this clarify what i am trying to do.

thanks a lot!! for any ideas as to how to implement this
DTS text file tasks.

martino






Quote:
-----Original Message-----
What do you want to do with the text file?

Why OPEN/CLOSE?

Yes it is possible just curious as to whther there is a
different way to do
what you want.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:05ce01c3da43$0a525de0$a401280a (AT) phx (DOT) gbl...
Hello,

Is it possible to have within a DTS package a task
that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied
(column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !



.


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 10:43 AM



Ahhhh OK

I would
1. open the text file up in a piece of VB Script.
2. Miss the first two lines
3. Staring at line 3 write out to another text file changing the last col
to "cur Cod2"
4. Save the text file to wherever
5. Set the flat file Source/Destination DataSource property to the location
of your new text file.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Allan,

Every week/month a text file is placed in a network
directory, this text file has some work to do before it
gets ready to be copied into A SQL Server Tbl.

First, the first two lines need to be deleted, second, at
the third line, the last header column name need to be
changed to "Cur Cod2" and lastly save the file.

If i can manage to do these tasks within a DTS package,
then the only thing left to do in the package will be
just to copy (column to column) to the SQL Srvr Tbl.

I hope this clarify what i am trying to do.

thanks a lot!! for any ideas as to how to implement this
DTS text file tasks.

martino






-----Original Message-----
What do you want to do with the text file?

Why OPEN/CLOSE?

Yes it is possible just curious as to whther there is a
different way to do
what you want.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:05ce01c3da43$0a525de0$a401280a (AT) phx (DOT) gbl...
Hello,

Is it possible to have within a DTS package a task
that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied
(column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !



.




Reply With Quote
  #5  
Old   
Rand Boyd [MS]
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 11:00 AM



You can use an ActiveX scipt to import the data and skip the first 2 lines.

Rand
This posting is provided "as is" with no warranties and confers no rights.


Reply With Quote
  #6  
Old   
martino rivaplata
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 11:06 AM



Thanks a lot!

Do you have a sample about these tasks, something that
get me started.

martino



Quote:
-----Original Message-----
Ahhhh OK

I would
1. open the text file up in a piece of VB Script.
2. Miss the first two lines
3. Staring at line 3 write out to another text file
changing the last col
to "cur Cod2"
4. Save the text file to wherever
5. Set the flat file Source/Destination DataSource
property to the location
of your new text file.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:0bf601c3daba$cdb0e3c0$a601280a (AT) phx (DOT) gbl...
Hi Allan,

Every week/month a text file is placed in a network
directory, this text file has some work to do before it
gets ready to be copied into A SQL Server Tbl.

First, the first two lines need to be deleted, second,
at
the third line, the last header column name need to be
changed to "Cur Cod2" and lastly save the file.

If i can manage to do these tasks within a DTS package,
then the only thing left to do in the package will be
just to copy (column to column) to the SQL Srvr Tbl.

I hope this clarify what i am trying to do.

thanks a lot!! for any ideas as to how to implement
this
DTS text file tasks.

martino






-----Original Message-----
What do you want to do with the text file?

Why OPEN/CLOSE?

Yes it is possible just curious as to whther there is
a
different way to do
what you want.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server
Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:05ce01c3da43$0a525de0$a401280a (AT) phx (DOT) gbl...
Hello,

Is it possible to have within a DTS package a task
that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied
(column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !



.



.


Reply With Quote
  #7  
Old   
martino rivaplata
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 11:29 AM



Hi thanks for the input,

do you have a sample script that get me started on these
tasks or where to go to find it.





Quote:
-----Original Message-----
You can use an ActiveX scipt to import the data and skip
the first 2 lines.

Rand
This posting is provided "as is" with no warranties and
confers no rights.

.


Reply With Quote
  #8  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Open/Save TXT file from DTS Package - 01-14-2004 , 11:47 AM



Opening up a text file would use something very similar to

dim txtStream
dim fso
dim strFileName


'Set up a reference to the Package and the FileSystemObject

set fso = CREATEOBJECT("Scripting.FileSystemObject")



'We need to know if the file we are trying to send to
'exists already. If not then we need to create it

strFileName =DTSGlobalVariables("gv_TextFileName").Value


if fso.FileExists(strFileName) <> -1 then
fso.CreateTextFile strFileName
end if


'Open the file up so we can write to it

set txtStream = fso.OpenTextFile(strFileName,2)

'and write

txtStream.WriteLine "A wandering minstrel I.."

'Clean up time

TxtStream.Close

set txtStream = Nothing
set fso = Nothing



Assigning the text file to the correct property can be done using this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thanks a lot!

Do you have a sample about these tasks, something that
get me started.

martino



-----Original Message-----
Ahhhh OK

I would
1. open the text file up in a piece of VB Script.
2. Miss the first two lines
3. Staring at line 3 write out to another text file
changing the last col
to "cur Cod2"
4. Save the text file to wherever
5. Set the flat file Source/Destination DataSource
property to the location
of your new text file.




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:0bf601c3daba$cdb0e3c0$a601280a (AT) phx (DOT) gbl...
Hi Allan,

Every week/month a text file is placed in a network
directory, this text file has some work to do before it
gets ready to be copied into A SQL Server Tbl.

First, the first two lines need to be deleted, second,
at
the third line, the last header column name need to be
changed to "Cur Cod2" and lastly save the file.

If i can manage to do these tasks within a DTS package,
then the only thing left to do in the package will be
just to copy (column to column) to the SQL Srvr Tbl.

I hope this clarify what i am trying to do.

thanks a lot!! for any ideas as to how to implement
this
DTS text file tasks.

martino






-----Original Message-----
What do you want to do with the text file?

Why OPEN/CLOSE?

Yes it is possible just curious as to whther there is
a
different way to do
what you want.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server
Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata"
anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:05ce01c3da43$0a525de0$a401280a (AT) phx (DOT) gbl...
Hello,

Is it possible to have within a DTS package a task
that
would open a Text file using KEDIT or any other text
editor then save the text file.

After file is saved, the text file will be copied
(column
to column) into a SQL server table.

any ideas will be highly appreciated

thanks a lot !



.



.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.