[quoted text, click to view] On 21 Sep 2005 14:56:55 -0700, "BenHanson" <bjh45964@gmail.com> wrote:
¤ Paul, one critical thing I left out, I need to drop 3 columns from the
¤ tabbed file, then filter out a specific string from each row. I
¤ couldn't see anyway to do this with the schema.ini.
¤
You only specify the columns you need in the SELECT statement. I can't address the filter issue
because I don't know specifically what you are referring to. In any event, some of the VBA functions
are available to Jet SQL in order to handle string manipulation.
¤ As for BCP, I'm not at all familiar with this. Looks like a command
¤ line utility. I'm not sure if I would want to shell out to a command
¤ line for this. I'm wanting the sort of seamless integration, grab
¤ specificly formatted file, dump directly into SQL without a lot of
¤ intermediaries. Also, I wouldn't be able to distribute BCP with an
¤ app.
¤
Bill probably was thinking of BULK INSERT which is the Transact SQL compliment to BCP. It could be
an alternative depending upon how you want to manipulate the column data.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_4fec.asp
I would agree with your assessment concerning BCP and DTS.
¤ I've actually come up with a solution, but it seems "10 times
¤ harder(and slower) than it has to be." Not to mention ugly code.
¤
¤ 1. import text file into dataset1 via System.Data.ODBC.OdbcDataAdapter
¤ 2. drop columns and name them
¤ 3. pass dataset1 to a sub which connects to the DB and loads dataset2
¤ to give it the correct schema,
¤ 4. for each datarow loop through dataset1 and adding a row to dataset2
¤ 5. Do DataAdapter.update(dataset2) to push the changes to SQL
¤
¤ It's not too slow for 1000 records. Maybe 8-10 seconds. I'm sure it
¤ could be much faster. Mostly it just doesn't seem like easily
¤ maintainable code. It also bothers me that the
¤ dataAdapter.insertCommand/sqlcommand with all the @fieldname parameters
¤ that must be defined, is all greek to me.
Yes, well this is definitely the slowest method you could have chosen. I would only use it as a last
resort, or if performance is not a requirement for your application.
Paul
~~~~