Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

update statement doesnt work when using linked server

Posted on 2008-10-08
2
Medium Priority
?
614 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

719 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