I want to select some data form another database in another server.
What I know is add a Linked Server, and run the T-SQL.
Is this way is a good choice, or is there any other way to run SQL in other database servers?
thanks.
Adding a linked server is fine.
You will then probably use the 4 part naming convention
select * from [server].[database].[Owner or Schema].[tablename]
Or you could look at OPENROWSET (Transact-SQL)
Includes all connection information that is required to access remote data from an OLE DB data source. This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB. For more frequent references to OLE DB data sources, use linked servers instead.
How
The upsides
The downsides
Alternatives
But as astander says, there is no real technical issue in accomplishing cross server sql.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With