Problems with "SELECT USER" - Result always dbo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roddy
    New Member
    • Dec 2006
    • 2

    Problems with "SELECT USER" - Result always dbo

    Hi there,

    i've got a problem with the command "SELECT USER". No matter who is logged in and no matter how he is connected (windows authentificatio n or not), the result is always 'dbo'. The same happens with "SELECT USER_NAME()".

    Has anyone a hint on what I could have made wrong?

    Thanks!
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Try this

    [PHP]SELECT SUSER_SNAME()[/PHP]

    Comment

    • roddy
      New Member
      • Dec 2006
      • 2

      #3
      Thanks a lot! That did the trick.

      Comment

      • iburyak
        Recognized Expert Top Contributor
        • Nov 2006
        • 1016

        #4
        It is a bug in Server 2000 that I reported to Microsoft.

        Function suser_name() has to return current login user but it returns null instead. It works perfectly on previous versions.

        suser_sname() is a work around not many people know of.

        Comment

        • navamnk
          New Member
          • Jan 2007
          • 15

          #5
          SUSER_NAME is given in SQL 2000 only for backward compatibility

          Comment

          • jooorj
            New Member
            • Dec 2006
            • 4

            #6
            goood
            I want to no how can I find last login for sql server ?

            Comment

            • iburyak
              Recognized Expert Top Contributor
              • Nov 2006
              • 1016

              #7
              Select Suser_sname()

              Comment

              Working...