July 30, 2010     |
Network Toaster
SQL Security Forums
Note: SQLSecurity.com does not allow nor require registration due to privacy concerns for users. SQLSecurity.com is open and anonymous for all. Please report any abuse or profanity.
Subject: Force login inside stored proc
Prev Next

Author Messages
Jag3256 (guest)

05/09/2008 6:22 AM Quote Reply Alert 
I’m trying to execute a stored procedure from a SQL Server job. The SP copies data from one server in domain A to a server/database in domain B and I have tested this with straight code (not in a stored proc) and it works because I’m logged on with my Login, which has security access to do this. When the job is executed it uses : domain B\servicesql as a logon and gets:



Executed as user: domain B\servicesql. Login failed for user ''. The user is not associated with a trusted SQL Server connection. [SQLSTATE 28000] (Error 18452). The step failed.



Do you know of a way to force my logon inside the stored proc?

Chip Andrews
Posts:113

05/09/2008 7:42 AM Quote Reply Alert 
If you are using SQL 2005 you can use the EXECUTE AS statement to do this. See Books Online for details. You will have to grant Impersonate rights to do this.

Forums > Discussions > SQL Server Security > Force login inside stored proc

Quick Reply
Username:  
Subject:  
Body:
 



ActiveForums 3.6
Copyright 1999 by Chip Andrews   |  Privacy Statement  |  Terms Of Use