Solved

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

Posted on 2013-01-12
3
430 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
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 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