• bikram.g.it (5/21/2013)


    I thought about that and I had checked the permission. I would have thought if permission was an issue then the result would be same when running from SSMS just by itself. What is confusing me is the difference in result between running from a Stored Procedure and running the same by itself as mentioned in my post earlier.

    my guess is that the calling user ends up using the proxy account that might be set up, whereas a sysadmin user, when going to xp_cmdshell, always uses the context of the startup account.

    do something like this to test it yourself:

    EXECUTE AS USER='Bob'

    EXECUTE MyProcedure @MyParameters

    --note the error message

    REVERT; --change back to sysadmin

    The proxy account for normal users, if it is set up:

    The startup account, which is used if the proxy is blank, or the user is a sysadmin

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!