dbTalk Databases Forums  

read in first line of text file

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


Discuss read in first line of text file in the microsoft.public.sqlserver.dts forum.



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

Default read in first line of text file - 10-19-2005 , 09:38 AM






I have a loop that reads a text file and then archives it. I currently have
it skip the first line of the text file because the first line contains
summary information. But I would like the summary information to be included
in each line that I pull from the rest of the text file.

So I thought that if there is a way just to read that first line into a
Global Variable, then I could add that Global variable to the data
transformation before it get inserted into the table. Is this the way to do
it? If so how do I read the first line of a text file into a global variable?

Thanks, AshleyT

Reply With Quote
  #2  
Old   
SQL
 
Posts: n/a

Default RE: read in first line of text file - 10-19-2005 , 10:16 AM






Assuming you are using File Sytem Object
find where the first VBCRLF is then read until there and that is your header
Put this in a global variable and add it to your transformation

http://sqlservercode.blogspot.com/

"AshleyT" wrote:

Quote:
I have a loop that reads a text file and then archives it. I currently have
it skip the first line of the text file because the first line contains
summary information. But I would like the summary information to be included
in each line that I pull from the rest of the text file.

So I thought that if there is a way just to read that first line into a
Global Variable, then I could add that Global variable to the data
transformation before it get inserted into the table. Is this the way to do
it? If so how do I read the first line of a text file into a global variable?

Thanks, AshleyT

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

Default Re: read in first line of text file - 10-19-2005 , 01:32 PM



Hello AshleyT,

Then do just that. In an Active Script task open the file and get the first
line and store in a GV. You can use the FSO to do this.

Allan


Quote:
I have a loop that reads a text file and then archives it. I
currently have it skip the first line of the text file because the
first line contains summary information. But I would like the summary
information to be included in each line that I pull from the rest of
the text file.

So I thought that if there is a way just to read that first line into
a Global Variable, then I could add that Global variable to the data
transformation before it get inserted into the table. Is this the way
to do it? If so how do I read the first line of a text file into a
global variable?

Thanks, AshleyT




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.