Solved

update statement doesnt work when using linked server

Posted on 2008-10-08
2
604 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

757 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

23 Experts available now in Live!

Get 1:1 Help Now