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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Credentials

Status
Not open for further replies.

togatown

Technical User
Jun 23, 2003
65
US
Can I execute an sp from an sp under different credentials?

Thanks....
 
Sort of.

You would have to shell out to the command prompt using xp_cmdshell then run isql (or osql) and log back in with the second account.
Code:
create procedure usp_Something as
...
declare @CMD varchar(1000)
set @CMD = 'isql -S ' + @@SERVERNAME + ' -U {username} -P {password} -Q "usp_Somethingelse"
exec xp_CMDShell @CMD
...

Now this will only work if the person running usp_Something is a sysadmin, or the SQL Agent Proxy Account has been setup correctly, and the user running the procedure has been given access to execute xp_cmdshell.

What result are you trying to come up with? I can't think of why you'd want to do this. If would be much easier just to grant the rights needed to run the second procedure.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Denny,

I am actualy trying to run sp_start_job so I can launch an asychronous task from an ASP page. I can set the timeout on the page for a longer period but I want the task to run independant of the user accidenatlly closing the page. I am sending approximately 15,000 emails which are customized for each recepient so even when queuing them.

The customer insist on being able to manually launch the process as he cannot predict when he will have the e-mail body prepared. His technical experience and knowledge are little to none and he has several files to upload before the process begins. To this end, I have created an ASP interface for him to log into, attach his files and upload them. My script takes over at that point and cleans up his files, organizes them and, hopefully, launches the mailing routine(s).

I really didn't want to give rights/access to my ASP scripts to the msdn db if I didn't need to.

Toga
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top