Okay, this is just too cool so I thought I'd share it.
Let's say you have access to a database on a remote server somewhere, and there's data there that you would love to have a copy of locally. Options, options, options...well, if we aren't using SQL Express we have lots of options for migrating the data. But in our case, we ARE using SQL Express, so we don't have easy access to linking servers and other more advanced commands. Wouldn't it be just perfect then if we could simply do a SELECT * INTO MyNewLocalTable from [remote table]? Turns out that I CAN if I turn on an option that is turned off by default. So first, I execute these two lines in a query window (I'm using SQL Server Management Studio Express):
RECONFIGURE
Then, I execute THIS query (well, one like it with suitable values substituted):
FROM OPENDATASOURCE(
'SQLOLEDB',
'Data Source=[url to remote server here, including port if needed];User ID=[sql username];Password=[sql password]'
).REMOTEDATABASE.dbo.SourceTable
Worked like a charm! Now I have a local copy of the remote data. In my case I migrated a little over 80,000 rows and it took about a minute or less. Saweeeet.
Doug out.
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Any idea if there's an equivalent for MySQL..?
Also, your comment spam method - while probably very effective - is a bit of a pain. I'm not recommending you turn it off or anything, I just wanted to provide my feedback on it "just so you know." Cheers!
as far as learning sql express...do you mean learning how to write queries, create tables, use the admin interface, or what? Of course, the best way to learn anything is to just jump in and play with it, which is what i always recommend. Think up a small project you want to create, then attempt to build it, using Google and your peer network (which you can include me in) to ask questions of as you go and can't figure things out. By the time you get it working like you want, you will have learned a WHOLE lot!
Any Ideas?
The reason I want to do this is because we get provided a view on a remote server (which does not belong to us), so I want to JOIN OPENROWSET from the view with local data from our database.
But I get a No Login-mapping Exists error. I cannot create a linked server because we use Express and the remote data does not belong to us. Any help would be greatly appreciated!
SELECT * INTO SfiTest.dbo.tblCustomertest
FROM OPENDATASOURCE(
'SQLOLEDB',
--'Data Source=[url to remote server here, including port if needed];User ID=[sql username];Password=[sql password]'
'Data Source=[OWDC];User ID=[sa];Password=[FishBait]'
).Sfidata.dbo.tblCustomer
but I get this....
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 11001, Level 16, State 1, Line 0
TCP Provider: No such host is known.
I'm looking at the remote server in SSMS. It's in my object explorer and I can navigate all thru the Databases. I can right-click on a table and SELECT TOP ?? I can start a new query while having the remote server hilited and run a query on it and it works (like I'm there)- all that works like it's sittin right here. However, when I try to run queries like the one above I get errors. It's kickin my butt.


