473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Insert rows from other server

Hi All

I want to insert rows from a table in a server
into another table in another server using
INSERT SELECT command. For example :

INSERT INTO Server1.database1.dbo.Tab1
SELECT * FROM Server2.database2.dbo.Tab1
WHERE Col1 = 1

Can the command like this work ?
If not, could you give me the solution ?

Please help me

Thanks in advance

John Smile


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
3 7351
You have the correct syntax. Assuming you have created a linked server on
the server where you run the code and provided you have the required
permissions then your INSERT statement looks OK. See the Linked Servers
topic in Books Online for details.

BUT, don't use SELECT * in production code and always list the target column
names in an INSERT statement. Following those good practices should make
your code easier to maintain if your table structures change.

--
David Portas
SQL Server MVP
--
Jul 20 '05 #2
Hi David,

Thank you for your reply.

Currently I have 2 servers that work as domain
controller and member server. Both of them run
SQL Server. My command works on the member server
and does not work on domain controller (DC).
The DC can not see the member server
and clients. It means when I open a client path
in my network places (using server windows explorer),
I get an error (\\Client is not accessible).
But the member server and clients can see the DC
and they also able to see them each other.

I think there is something wrong in my windows
setting that causes the command does not work on
the DC. If you do not mind, could you show me
what setting that cause this problem ?

John Smile

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Hi David,

Thank you for your reply.

Currently I have 2 servers that work as domain
controller and member server. Both of them run
SQL Server. My command works on the member server
and does not work on domain controller (DC).
The DC can not see the member server
and clients. It means when I open a client path
in my network places (using server windows explorer),
I get an error (\\Client is not accessible).
But the member server and clients can see the DC
and they also able to see them each other.

I think there is something wrong in my windows
setting that causes the command does not work on
the DC. If you do not mind, could you show me
what setting that cause this problem ?

John Smile

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: grumfish | last post by:
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor()...
1
by: smile | last post by:
Hi All I want to insert rows from a table in a server into another table in another server using INSERT SELECT command. For example : INSERT INTO Server1.database1.dbo.Tab1 SELECT * FROM...
1
by: Murugavel | last post by:
Hi all, Now,we stored uploaded files into our webserver(where the place our site is running) by normal upload function ASP.NET ,but we brought a new server for keeping files. How Can we ...
7
by: Marek | last post by:
Whe i'm running my .net aplication from share on other server, i've got an error. Can someone explain what i must do? Unhandle exception:System.Security.SecurityException: Permission demand type...
2
by: Mansi | last post by:
I'm trying to automate excel from c#. One of the things I need to do is to copy/paste/insert rows in excel via c# code. I tried to do the following: 1) Select a row in excel (a12 to k12) 2)...
4
by: RG | last post by:
Using VB.NET, How do I insert rows from a SQL Server table into an Access table with the same structure (and also the reverse, from Access to SQL)? I’m new to this, so here’s what I’ve...
6
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender...
9
by: =?Utf-8?B?TWlrZVM=?= | last post by:
Can anyone tell me how to insert variables for server info in a SQL connection statement. For example, in the following statement: ("Server=KIN-SSQL02;" & "Database=FTQ;" & "User ID=abc;" &...
2
by: gnewsgroup | last post by:
I am new to the asp.net Table web control. I am using it to customize my presentation of data. I cannot implement the idea with DataGrid or GridView. Basically, I would like to have something...
3
by: =?Utf-8?B?Sm9obiBT?= | last post by:
Hi, I'm trying to publish a new web service that I've written. It's fine when I publish it on the local PC but I get Publish failed in the development environment when I try to publish it to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.