*-- if the databases are on the same server INSERT INTO TargetDb.dbo.TargetTable SELECT * FROM SourceDb.dbo.SourceTable WHERE WhereClause *-- if the dbs are on different servers, you'd have to create a linked server and then use syntax like this: INSERT INTO TargetServer.TargetDb.dbo.TargetTable SELECT * FROM SourceServer.SourceDb.dbo.SourceTable WHERE WhereClauseSince the table structures are identical, you wouldn't even have to mess with fieldnames.
>SqlExec (nOrigTableHandle, "Select * from " + cTableName + "... where " + cWhereClause, "TempCursor") > >Select TempCursor >Go Top > >Scan > >* Here I must move each field of each row of TempCursor to temporary variables > > . . . . (?) > >* Here I must build a string with the Insert SQL > > cInsertSqlString = "Insert Into " + cTableName + "...(?)..." > > SqlExec (nDestTableHandle, cInsertSqlString, "") > >EndScan >>What is the best way to do this?