I would like to extract a large dataset from an SQL server database on one server and then include that dataset on another database on a different server. As link server is not an option, I have tried a powershell script, and would like something like:
$connection = New-Object System.Data.SqlClient.SqlConnection $command = New-Object System.Data.SqlClient.SqlCommand ... etc for SqlDataAdapter as well $adapter.Fill($dataset1) $connection2 = ... (to a database on another server) $command2 = ... Load $dataset1 into $command2 $command2.Fill($dataset2)
How do I load dataset 1 into command 2?
Have you thought about the SQLBulkCopy class? Here's a powershell function that uses it to push data from one dataset to a different SQL Connection.