Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update SQL table from Linked Server

Status
Not open for further replies.

dendic

Programmer
Jan 19, 2003
106
US
I'm trying to use the following procedure to update data to a table in sql from my linked server. The procedure executes with no error messages but no date is inserted into the table.
USE [LogisticsSQL]
GO
/****** Object: StoredProcedure [dbo].[Test] Script Date: 03/08/2011 13:55:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Test]
AS
INSERT INTO dbo.customers (ListID)
SELECT ListID FROM qodbc...customer
 
Connect to the server that runs the SP and try running just the SELECT query. If that runs then it might be the lack of database on the INSERT line
Code:
INSERT INTO [database\instance].dbo.customers (ListID)
Note this is just a guess.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
I don't know if this is just a typo in your post or if it is really in your script:

SELECT ListID FROM qodbc...customer

There should only be two periods between qodbc and customer.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Also, just realized what you are saying here...update data to a table in sql from my linked server.

Nowhere in your stored procedure does it say where the linked server is.
Code:
INSERT INTO dbo.customers (ListID)
SELECT ListID FROM qodbc...customer
That script will just pull the data from your local server into the table on your local server.

I think you really need this:
Code:
INSERT INTO dbo.customers (ListID)
SELECT ListID FROM \\linked_servername.qodbc..customer

-SQLBill


The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
SQLBill, Thanks I made a typo on my post. Meant to include the database name.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top