March 24, 2005 at 1:57 pm
I am creating a package that downloads a file from an ftp site. I then want to import that file to a table. The file is a comma delimited text file. The first row is the field names, then data, the last row is the date the file was created and a count of how many records were downloaded. I can get it to not import the first row by setting the first row to 2. Since the amount of rows in this file could vary I don't know what to put for the last row.
Is there a way to set the Bulk Insert up to not insert the last row?
Thanks.
March 24, 2005 at 2:02 pm
Roberta,
I do something like this to get a count of valid lines:
SET oFile = oFS.OpenTextFile(filename)
iLastRow = 0
DO UNTIL oFile.AtEndOfStream
sString = oFile.ReadLine
iLastRow = iLastRow + 1
LOOP
March 24, 2005 at 2:12 pm
I am new at doing DTS packages and I was just using enterprise manager and tried to create a Bulk insert task. I was wondering if there was a way to do it there without code.
Thanks for showing me the way to do it in code.
March 28, 2005 at 9:08 am
You're looking for the BCP application. Fairly simple when you learn the parameters. Just google for "SQL BCP"
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply