Solved

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

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now