sql server - Copy data from one database to another using VB.NET -
I have to copy the data from one database to another using the VB.NET program. The target database is SQL Server's source database, some ownership is ODBC compliant database.
I need to loop through a list of tables to copy. Read the data from the source database table for a modified date. Delete the date related to the target database table and enter the record from the source table. The databases are of the same structure i.e. The table name and the field name, but the data types may vary (although they are analog, double in the source, float in the target) no primary key exists.
This is how I can do it:
First, execute the order to remove the target. I can then use a detourder to get data from the source, loop through the item and create an insert order for each line. Add and execute parameters in the command with appropriate values. And wrap the whole thing in the transaction.
I was just thinking that I remember any trick here. Any suggestion /
This trick will be to use set-based operation and 'line at a time' The concept of which we had taught the programmer first :)
Here's some pseudo angle
Built in DestTable (column, column ...) (modified from SourceTable Choose the router where date = is modified)
Perhaps your needs are more complex and require a line from the line approach But this is not usually the case.
I can move this code to a job and schedule it on SQL, it can also be a stored procedure running from .NET.
In addition, it is more likely to use SBIS to transfer DB unless you are not using certain changes there.
Comments
Post a Comment