dbTalk Databases Forums  

Adding/Verifying Header Records - Bulk Copy

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


Discuss Adding/Verifying Header Records - Bulk Copy in the microsoft.public.sqlserver.dts forum.



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

Default Adding/Verifying Header Records - Bulk Copy - 09-06-2004 , 11:33 AM






Hi!
I am using DTS SQL DMO Bulk Copy program to bulk export/import data.
Now i have 2 problems!

1. The incoming data file will have a header record containing the no.
of records in the file followed by the file data. Now - how do i check
the no. of records in the flat file is same as the no. of records
mentioned in the header?

My option is:
Read the flat file using Activex script/FSO object with the first line
and check the no. of records. Now compare it by Dividing the file size
by a single record size.

Any comments? Is there any alternative

2. While exporting data I need to add a header record while using SQL
DMO BCP, SQL DMO table Export data function. The header record will
contain the no. of records exported. Do i need to use ActiveX
script/FSO object here also? Is there any alternative?

Thanks in advance

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

Default Re: Adding/Verifying Header Records - Bulk Copy - 09-06-2004 , 01:54 PM






Are you using DMO or DTS or DMO in DTS?

The way I would do it with a text file is to BULK INSERT the file into a
staging table and do a SELECT COUNT(*) from there.

There is no way I know of in DMO to add a header to the file but you could
combine this with FSO I guess.

Personally What I do is this. I have my feeds provided in this manner

<Feed Provider System>_<Feed Type>_<Batch Date YYYYMMDD>_<RowCount>.csv


I can parse the name of the file to get the information I need.


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Karthik R" <dtsguy1 (AT) rediffmail (DOT) com> wrote

Quote:
Hi!
I am using DTS SQL DMO Bulk Copy program to bulk export/import data.
Now i have 2 problems!

1. The incoming data file will have a header record containing the no.
of records in the file followed by the file data. Now - how do i check
the no. of records in the flat file is same as the no. of records
mentioned in the header?

My option is:
Read the flat file using Activex script/FSO object with the first line
and check the no. of records. Now compare it by Dividing the file size
by a single record size.

Any comments? Is there any alternative

2. While exporting data I need to add a header record while using SQL
DMO BCP, SQL DMO table Export data function. The header record will
contain the no. of records exported. Do i need to use ActiveX
script/FSO object here also? Is there any alternative?

Thanks in advance



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.