Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mssql how to select from table and insert into another server ?

Posted on 2013-01-12
3
Medium Priority
?
442 Views
Last Modified: 2013-01-22
i have two database what i need is to do something like this using sql server managment studio

the database  [mixmixmix]. is founded in the server 10.1.1.26
and the database [CGI_SMS_SERVICES] is founded in the server 10.1.1.5
the two sql server has login and password ?????????
how i can do this ?

/****** Script for SelectTopNRows command from SSMS  ******/

INSERT INTO [mixmixmix].[dbo].[CGI_SMS_dafif]
           ([reqport]
           ,[message]
           ,[msisdn]
           ,[datetimein])

SELECT 
      [ReqPort]
      ,[Message]
      ,[MSISDN]
      ,[datetimein]
  FROM [CGI_SMS_SERVICES].[dbo].[CGI_SMS_d752265] 
  WHERE Datein between '20130109' and '20130111'

  union all 

  SELECT [ReqPort]
      ,[Message]
      ,[MSISDN]
      ,[datetimein]
  FROM [CGI_SMS_SERVICES].[dbo].[CGI_SMS_d84486] 
  WHERE Datein between '20130109' and '20130111'

  union all 

  SELECT [ReqPort]
      ,[Message]
      ,[MSISDN]
      ,[datetimein]
  FROM [CGI_SMS_SERVICES].[dbo].[CGI_SMS_d670131] 
  WHERE Datein between '20130109' and '20130111'

Open in new window

0
Comment
Question by:afifosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1500 total points
ID: 38770120
0
 

Expert Comment

by:Ibrahim_Malhas
ID: 38770210
You can link these servers
http://msdn.microsoft.com/en-us/library/ff772782.aspx
or you can go to the first DB>>R.C>>Import Data
Choose the destination and the source to migrate the data
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 38781703
create link server and

do like

Insert Into Db.schema.table values(fld1, fld2) select fld1, fld2 from Linkedserver.database.schema.table
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question