dbTalk Databases Forums  

Stripping off header information

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


Discuss Stripping off header information in the microsoft.public.sqlserver.dts forum.



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

Default Stripping off header information - 04-20-2005 , 11:19 AM






Hi,

I'm fairly new to DTS and I'm trying to import some flat text files into a
sql server staging table, but the text file has up to 195 lines of junk (this
can be variable) that I'm not interested in. There is a marker line, which
reads START-OF-DATA.

I want to start the import 2 lines after that line. There is also some
footer information that I don't want after the line END-OF-DATA that I'm not
interested in. The data is delimited with a |. The file sizes are 20-100MB.

Easy to do?

Reply With Quote
  #2  
Old   
Francesco Anti
 
Posts: n/a

Default Re: Stripping off header information - 04-20-2005 , 11:31 AM






You only have to write some lines of Transformation script, using a global
variable because your script is executed at every line. Something like this:
Set the global variable "Rowstate" value = 0 at package startup. Then in the
transformation script

if DTSGlobalVariables("Rowstate") = 0 then
if DTSSource("field") = "START-OF-DATA" then
DTSGlobalVariables("Rowstate") = 1
end if
Main= DTSTransformStat_SkipRow
exit function
else
..define your transformations
Main = DTSTransformStat_OK
end if

Francesco Anti

"adam" <adam (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I'm fairly new to DTS and I'm trying to import some flat text files into a
sql server staging table, but the text file has up to 195 lines of junk
(this
can be variable) that I'm not interested in. There is a marker line, which
reads START-OF-DATA.

I want to start the import 2 lines after that line. There is also some
footer information that I don't want after the line END-OF-DATA that I'm
not
interested in. The data is delimited with a |. The file sizes are
20-100MB.

Easy to do?



Reply With Quote
  #3  
Old   
M D
 
Posts: n/a

Default Re: Stripping off header information - 04-20-2005 , 12:12 PM



Were it me I would write a quick little app to execute your pattern and
preprocess the file. Command line would be very easy. Windows with a
getFilename interface wouldn't be much harder.

thx
md

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #4  
Old   
adam
 
Posts: n/a

Default Re: Stripping off header information - 04-21-2005 , 03:49 AM



Thanks guys, I used a VBScript in the end to do it. Made sense to do it
outside of DTS.

"M D" wrote:

Quote:
Were it me I would write a quick little app to execute your pattern and
preprocess the file. Command line would be very easy. Windows with a
getFilename interface wouldn't be much harder.

thx
md

*** Sent via Developersdex http://www.developersdex.com ***


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.