-
I was wondering if anyone knew if it is possible to copy a recordset or a row from a recordset to another recordset or row of a recordset. Clear as mud? For example... I have a dBase database and I want to copy a bunch of rows from one of the dbase tables to a sql server database table. what is the fastest way to do this.. any ideas? right now I have it looping through every field of every row and copying everything field by field... there has to be a faster way to do this...
-
Have a look at the Clone method.
-
looked at it... doesn't work for what I need...
thanx anyway.
-
I would use the INSERT INTO SQL statement with the SELECT option. Examples:
(1) For cases where the destination table has the same number of fields (and compatible datatypes) as the source table, you can use:
INSERT INTO DestinationTable SELECT * FROM SourceTable;
(2) For cases where the number of fields are different, or are in a different order, etc., you can use this variation:
INSERT INTO DestinationTable (DestField1, DestField2, etc.) SELECT SourceField3, SourceField4, etc. FROM SourceTable;
-
Thanx, I've been trying that, but my problem is one table is from a dbase database and the other table that I want to copy to is in a sql server database. Any ideas?
-
Create a new recordset on the fly and populate it with your data. Then connect to SQL server, loop through the new recordset, and use SQL INSERT INTO statements.
-