Link to home
Start Free TrialLog in
Avatar of ankouny
ankounyFlag for United States of America

asked on

Select Statement between different servers?

Hello Guys,
Is there anyway I can select data from a database that is in server 1 and insert it into a database in server 2 ?

Thanks
Avatar of Pratima
Pratima
Flag of India image

Export the data in Excel file
tehn import in new database
u can use linked server option
Avatar of dj_alik
dj_alik

SQL Server has a few mechanisms to reach out to another server (even another server type) and query data from within a Transact-SQL statement. Among them are a set of stored credentials and information (called a Linked Server), a statement that uses a linked server called called OPENQUERY, another called OPENROWSET, and one called OPENDATASOURCE.
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ankouny,

If you want to fetch the data from another server in a ad-hoc manner or one time, then you can go with OPENDATASOURCE query provided in my earlier comment.
If you want to do this is in a regular manner and periodically, then you can create a Linked Server ( provided you have appropriate privileges) and fetch records appropriately.
Yes, you can do it, if the servers are linked. See screen shot for more help  User generated image
PatelAlpesh,

>> Yes, you can do it, if the servers are linked.

You can also do it without creating a Linked Server using OPENDATASOURCE as I mentioned above..