dbTalk Databases Forums  

parsing file before inserting into table

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


Discuss parsing file before inserting into table in the microsoft.public.sqlserver.dts forum.



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

Default parsing file before inserting into table - 12-11-2004 , 09:13 AM






I'm beginer (ACCESS developer wanting to learn SQL) with DTS and I would like
to parse the TXT file I'm importing before I insert data into my SQL 7.0
table. I have the following report that I receive each month and I would like
to import the detail not the header of the report.

text file look like this
---------------------------------------------------------------------------------
page1 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36 49,000.36
......

page2 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36 29,000.36


End of the repor
-----------------------------------------------------------------------------------

the data I want to insert are:
char char char char reel
reel
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36 49,000.36
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36 29,000.36

I went in transformation tab but was unable to figure out VBScript to skip
the header and footer lines so I get type mismatch importing error. Could
anybody help with that easy one ?

FRED


Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: parsing file before inserting into table - 12-13-2004 , 07:55 AM






Fred,

What you want to do here is configure the file connection as having one big
column. The activeX transformation should then be something like:

If Left(DTSSource("<..>"), 1) = "T" Or Left(DTSSource("<..>"), 1) = "U" Then
'code to split record into separate destination columns goes here
Main = DTSTaskExecResult_Success
Esle
Main = DTSTransformStat_SkipRow
End If

Ilya

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

Quote:
I'm beginer (ACCESS developer wanting to learn SQL) with DTS and I would
like
to parse the TXT file I'm importing before I insert data into my SQL 7.0
table. I have the following report that I receive each month and I would
like
to import the detail not the header of the report.

text file look like this:
--------------------------------------------------------------------------
-------
page1 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36
49,000.36
.....

page2 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36
29,000.36


End of the report
--------------------------------------------------------------------------
---------

the data I want to insert are:
char char char char reel
reel
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36
49,000.36
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36
29,000.36

I went in transformation tab but was unable to figure out VBScript to skip
the header and footer lines so I get type mismatch importing error. Could
anybody help with that easy one ?

FRED




Reply With Quote
  #3  
Old   
FRED
 
Posts: n/a

Default Re: parsing file before inserting into table - 12-13-2004 , 08:13 AM



Thanks very much, it works.

FRED

"Ilya Margolin" wrote:

Quote:
Fred,

What you want to do here is configure the file connection as having one big
column. The activeX transformation should then be something like:

If Left(DTSSource("<..>"), 1) = "T" Or Left(DTSSource("<..>"), 1) = "U" Then
'code to split record into separate destination columns goes here
Main = DTSTaskExecResult_Success
Esle
Main = DTSTransformStat_SkipRow
End If

Ilya

"FRED" <FRED (AT) discussions (DOT) microsoft.com> wrote in message
news:8211AC84-6C30-4CD1-A426-008854D4FD5D (AT) microsoft (DOT) com...
I'm beginer (ACCESS developer wanting to learn SQL) with DTS and I would
like
to parse the TXT file I'm importing before I insert data into my SQL 7.0
table. I have the following report that I receive each month and I would
like
to import the detail not the header of the report.

text file look like this:
--------------------------------------------------------------------------
-------
page1 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36
49,000.36
.....

page2 amortization report
12/10/2004
for branch 9125 bidon cie

code asset# descr dep meth book val dep val
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36
29,000.36


End of the report
--------------------------------------------------------------------------
---------

the data I want to insert are:
char char char char reel
reel
T 390000 Dell server SLN 12,000.25 4,500.35
U 580000 Building SLD 50,000.36
49,000.36
T 391000 Workstation SLN 2,000.25 500.35
U 588000 Loader SLD 30,000.36
29,000.36

I went in transformation tab but was unable to figure out VBScript to skip
the header and footer lines so I get type mismatch importing error. Could
anybody help with that easy one ?

FRED





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.