return NT domain and login name

  • Hi folks,

    Quick question. I'm using SQL server 2000 and would like to know if there's a function that returns the DOMAIN\login of the current user.

    I know suer_sname() works in SQL 2005 but does this work in 2000? If not, is there something else I can use?

    Many thanks

  • pwatson (8/13/2009)


    I know suer_sname() works in SQL 2005 but does this work in 2000?

    Have you tried suser_sname on 2000 to see if it works?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi Gail,

    Thanks again for responding to my threads; you've been very helpful.

    I wasn't sure if it worked on 2000 so just wanted to be sure. At the moment I'm using

    SELECT

    loginame=rtrim(loginame)

    FROM master.dbo.sysprocesses

    WHERE spid = @@spid)

    I'll give it a bash.

    Thanks

    [Edit]

    Actually, I should have clarified this Gail, I'm working on SQL Server 2005 with compatibitly mode and can't get access to the SQL 2000 servers today which is why I use asking...

    Paul

  • Google "book on line SQL2000" (if you don't have MSDN page bookmarked) and in no time you'll be on this page:

    http://msdn.microsoft.com/en-us/library/aa299742(SQL.80).aspx

    That simple.

    _____________
    Code for TallyGenerator

  • Thanks again

Viewing 5 posts - 1 through 4 (of 4 total)

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