Solved

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

Posted on 2013-01-12
3
433 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 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Syntax 6 52
Need a solid Expert on this Group By Query Syntax Help. 3 55
Complex SQL Server WHERE CLause 9 40
SQL - Using an 'array' kind of variable 5 17
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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…

738 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