Getting my own password in an SP

  • We develop an app that connects to a SQL back end. Users log into the app using various usernames and passwords. But the app always logs into SQL Server as a sysadmin account called "ConEst". The standard user doesn't need to know this password in normal usage.

    I'm working on an SP that will use xp_cmdshell to export a bunch of data via bcp. As per what I've described above, this SP is always being executed by the ConEst user. But I need the ConEst user's password for the command string, so I can do this:

    exec xp_cmdshell @Query queryout @Filename -n -U ConEst -P @pwd, no_output

    So... is there some way for the logged in user to derive his own password?

    Thanks!

    Ron Moses

    ConEst Software Systems

    -----
    a haiku...

    NULL is not zero
    NULL is not an empty string
    NULL is the unknown

  • nope there's no way, AFAIK.

    your options are to use a trusted connection with their windows login so you don't need the username and password at all,, or to use EXECUTE AS inside the procedure so it runs as a user that has permissions;

    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!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply