dbTalk Databases Forums  

BCP csv file only required Rows

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


Discuss BCP csv file only required Rows in the microsoft.public.sqlserver.dts forum.



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

Default BCP csv file only required Rows - 12-01-2004 , 04:26 PM






Hello folks,
I want to BCP a csv file in to a table.
1. The csv file has footer records. Theres a blank line after the data
itself and the footer records start.
The number of data records can vary everyday.

My question is
How can i BCP only upto the data records.
I am quite new to DTS. Any help would be appreciated.

Thanks



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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

Default Re: BCP csv file only required Rows - 12-02-2004 , 08:20 AM






Anon nymous,

BCP does not care about content. You can import all rows and delete unwanted
afterwards. Or use Transformation task instead and fail unwanted rows.

Ilya

"Anon nymous" <jayalakshmi.anbanandam (AT) corporate (DOT) ge.com> wrote

Quote:
Hello folks,
I want to BCP a csv file in to a table.
1. The csv file has footer records. Theres a blank line after the data
itself and the footer records start.
The number of data records can vary everyday.

My question is
How can i BCP only upto the data records.
I am quite new to DTS. Any help would be appreciated.

Thanks



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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

Default Re: BCP csv file only required Rows - 12-02-2004 , 11:15 AM



Since I use a format file to BCP only the Columns needed for BCP, it
fails the destination type column is Dateval type.So it fails.
How can i delete the unwanted rows from a Data file in a Data
transformation Task. I wasnt successful using that for this purpose.
Would appreciate if you could elaborate.
Thanks






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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

Default Re: BCP csv file only required Rows - 12-03-2004 , 07:44 AM



Help,

You need to test for the value being of date data type in an ActiveX
transformation:

Function Main
If Not IsDate(DTSSource("<Field Name goes here>")) Then
Main = DTSTransformStat_SkipRow
Else
Main = DTSTransformStat_OK
End If
End Function

Ilya

"Help" <help (AT) devdex (DOT) com> wrote

Quote:
Since I use a format file to BCP only the Columns needed for BCP, it
fails the destination type column is Dateval type.So it fails.
How can i delete the unwanted rows from a Data file in a Data
transformation Task. I wasnt successful using that for this purpose.
Would appreciate if you could elaborate.
Thanks






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #5  
Old   
Help
 
Posts: n/a

Default Re: BCP csv file only required Rows - 12-03-2004 , 02:15 PM



Hi,
Thanks..I tried to copy the required columns to the table directly.
Note: ISdate function doesnt work on the CsV dile source column. So i
used a Text function.
It says the "Encountered Invalid data value for DATEVAL column.
The destination table has the file of datatype DATETIME. So i think its
not accepting the Char value. When i commen out that line, it runs fine.
How to resolve this issue. I will be good if this is resolved. Below is
my code. Thanks for all your help.


Function Main()

If Left(DTSSource("Col001"),1) = "2" then
' DTSDestination("DATEVAL") = DTSSource("Col001")

DTSDestination("RATE") = DTSSource("Col007")
DTSDestination("DESCRIPTION") = DTSSource("Col006")
DTSDestination("RIC") = DTSSource("Col005")
DTSDestination("ID") = DTSSource("Col002")
Main = DTSTransformStat_OK
Else
Main = DTSTransformStat_SkipRow
End If
End Function






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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.