Results 1 to 4 of 4

Thread: NT User Names

  1. #1
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912

    Unanswered: NT User Names

    Hi

    Is it possible to obtain an NT username (with T-SQL) from a user connecting to SQL Server with a SQL log in via ODBC?

    Thanks in advance
    Testimonial:
    pootle flump
    ur codings are working excelent.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Look up "Niladic" functions in Books Online for an explantion of the various connection-related information that is available to SQL Server.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Thanks for that. 'Niladic' threw up a few new functions but there are synonomous with others I have tried:

    SUSER_SNAME() , USER , SUSER_SNAME(SUSER_SID()) , SESSION_USER, SYSTEM_USER , CURRENT_USER

    Each returns the SQL Login (or similar) but not the NT Login.

    If anyone has an answer I would be grateful - I can get around it but I would prefer the simplicity of SQL Server obtaining the information for itself.
    I can read the NT username with a VB API call and pass it as a parameter - is SQL Server able to do the same perhaps?

    Cheers
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    You can probably use HOSTNAME value from sysprocesses while querying LDAP.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •