Query to get data from another database server

In this tutorial we will learn how to get data from another database server. It is quite handy to remain sit on one database server and get data from another database server. Let's have a look over how to do so

Query to get the table data from another database server

select * from [database_server_name].[database_name].dbo.tbl_name

If the database name or database server name contains special characters such as -,_ then you have to put their name inside square brackets[]like i did above.

Note:- For getting data from one database server in another database server, both should be connected each other via link server.

I hope it will be great helpful for you.

0 comments: