Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

update statement doesnt work when using linked server

Posted on 2008-10-08
2
Medium Priority
?
616 Views
Last Modified: 2012-05-05
I have a update statement that is using a linked server method from within a SPROC

when i try and create the SPROC - it fails on first update
showing error message
Msg 7416, Level 16, State 1, Procedure sp_LeaverProcess, Line 7
Access to the remote server is denied because no login-mapping exists.

But when i do
select * from NEMESIS_LINKED.intranet.dbo.tblusers - the select works fine

Why is the update failing via the call but the select isnt


CREATE PROCEDURE [dbo].[sp_LeaverProcess] 
AS
 
 
/* Set user status to Leaver for Intranet */
 
UPDATE NEMESIS_LINKED.intranet.dbo.tblusers
set status = 2, LeaveDate = GetDate()
 
FROM NEMESIS_LINKED.Intranet.dbo.tblUsers tblUsers_1 
JOIN dbo.view_SelectTodaysLeavers LEAV
  ON tblUsers_1.EmployeeID = LEAV.LoginID
 
/*Revoke Worksite login access */
 
update ws
set ws.login='N'
from MINOS_LINKED.docs.mhgroup.docusers ws, view_SelectTodaysLeavers TODL
where ws.userid = TODL.LoginID collate Latin1_General_CI_AS

Open in new window

0
Comment
Question by:mooriginal
2 Comments
 
LVL 4

Expert Comment

by:Maxi84
ID: 22667724
Have you added the necessary login mappings using sp_addlinkedsrvlogin?  There's an explanation of linked server security here: http://msdn.microsoft.com/en-us/library/aa213768(SQL.80).aspx
0
 

Accepted Solution

by:
mooriginal earned 0 total points
ID: 22667785
i have
ive fixed this by changing the update statement and aliasing the table
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

963 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