473,398 Members | 2,403 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,398 software developers and data experts.

INSERT SELECT from different server

Hi Team,

I have 2 tables on two database servers and I want table1 to feed table 2.
I have a database user "WEB" on both the databases with diff passwords.
I open a SqlConnection connection for database2 and execute following thru ExecuteNonQuery.

Query = "INSERT INTO table2 SELECT * FROM Server1.Database.dbo.table1

On running this query, I am getting below error


TCP Provider: An existing connection was forcibly closed by the remote host. Login failed for user 'WEB'. OLE DB provider "SQLNCLI" for linked server Server1 returned message "Communication link.

I searched a lot but I did not find related with my scenario.
Please let me know if this is not the way or if I am doing anytihng wrong.

Thanks in advance!!
Feb 15 '10 #1
6 2237
tlhintoq
3,525 Expert 2GB
Database How-to parts 1 and 2
Database tutorial Part 1
Database tutorial Part 2
Feb 15 '10 #2
thanks you very much! It would be great if you can direct me what exactly I should look for in above tutorials!

Thanks again!!
Feb 15 '10 #3
tlhintoq
3,525 Expert 2GB
Without knowing your skills, what you know and what you don't...
All I can say is "learn all that you can. Do all of the tutorials."
Combined the two can't take an hour. You should breeze over what you know and learn new things along the way.
Feb 15 '10 #4
:) great idea - I will go thru it and refresh myself.

But I would like to know about the standard approach for such cases. I have following options

1. how about linking the servers. What are the +ves and -ves.
2. Updating the tables using dataset or datareader.

It would be quick if I can run it thru a single query as written below.

INSERT INTO table2 SELECT * FROM Server1.Database.dbo.table1

please let me know if its possible and if yes what kind of setup is required.

Thanks again for your prompt response.
Feb 15 '10 #5
tlhintoq
3,525 Expert 2GB
I'm afraid that queries and such aren't my thing. I'm just familiar with the tutorials on the site and try to point people in the right direction for research - until an expert with more specific experience can jump in.
Feb 15 '10 #6
great - thanks man, I am searching on it hope I will get smthing.
Feb 15 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: J.D. Buehls | last post by:
I have an .asp page with a form to copy job responsibilites form one job to another. It is a hotmail type interface with checkboxes besides each responsibility. After submitting, it should copy...
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
1
by: Scrappy | last post by:
I have a table named expense_report. It has over 100 columns in it. Most of the columns are of type "money(8)". I have a form on my website that I created using Frontpage and a custom query. I...
2
by: Elvira Zeinalova | last post by:
Hei, We have 2 MS SQL SERVER 2000 installed on 2 different servers (2 separated machines). I am triing to connect them så that when one row is added to the table in the database in main server - ...
4
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
2
by: Steve Kuekes | last post by:
I have two sql servers, I have defined each one as a linked server to the other. I can mostly access the servers from one another, but I get the following error on a sql insert. Insert...
9
by: rhaazy | last post by:
Using MS SQL 2000 I have a stored procedure that processes an XML file generated from an Audit program. The XML looks somewhat like this: <ComputerScan> <scanheader>...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.