Sometimes I need to have a quick way of transferring data from one database to another running on a separate machine, especially when the table structures are identical or similar, it saves time. M$ SQL Server 2005 has a feature called linked servers.
- Give a name to your server: SERVER123
- Choose a provider depending on the type of server you want to connect; the safest and the easiest may be ODBC so that you can link many different types of servers.
- Data source can be something like this:
- Check the security details and other options as well.
If you want to use an ODBC connection, define it first using Data Sources inside control panel of Windows.
Then, you can run a script using SQL Management Studio or your favourite database management tool such as this:
INSERT INTO TableA (column1, column2, ...)
SELECT columnA, columnB, ...
(dbo is for the schema name)