Return Domain name in SQL

  • Hi,

    I'm writing SQL code to temporarily set up a proxy account using the following sproc:

    xp_sqlagent_proxy_account N'SET'

                            , N'DomainName'

                            , N'NTUser'

                            , N'NTUserPassword'

    I can retrieve the NTUser and the NTUserPassword from a table in the database, but not the domain name.

    Does anyone know of any SQL variable or code that will return the current domain name.

    Thanks in advance,

    sc.

  • Try looking at USER_NAME() or CURRENT_USER  Of course you will probably need to parse the field.  This will ONLY work if trusted connections are used...



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Thanks AJ. Your reply put me on the right track.

    I found an extended sproc called "xp_loginconfig" which should do the job.

    Cheers,

    sc.

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

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