Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 system user, current user and user_name()

Author  Topic 

rajk
Starting Member

20 Posts

Posted - 2003-08-12 : 08:45:50
Hi,

I am trying to identify what is the user/login that I am logged into the database when I use windows authentication.

I tried checking for user_name(), current_user and system_user values, as suggested in the archives of sqlteam forums. Two of them (user_name() and current_user) show me 'dbo' and system_user shows me the actual windows login.
But this windows login is not a valid database user. But still I am able to access database objects that are accessible to dbo. Please clarify.
Thanks
Raj

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-08-12 : 09:07:48
Do you have any NT groups with access to the SQL Server? Also, the local administrators group of the server will automatically have sysadmin role in the SQL Server.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-12 : 12:36:55
AS Andraax mentioned, your account is probably a member of some group which has administrative privileges on the server. By default that means that all of those accounts are members of the sysadmin role in SQL Server, which means that the user will be mapped to the dbo user in every database.

What do you mean that the user returned by system_user is not a valid database user?

Tara
Go to Top of Page

rajk
Starting Member

20 Posts

Posted - 2003-08-13 : 00:54:02
Thank you for the help, Andraax and tduggan.

Also, in response to tduggan's question, when I say system_user is not a valid databse user, I mean to say that there is no login in sqlserver with the windows login name I used to connnect to database. Hence there are no users in any database with this login id. Hope than answers your question. Please respond.




Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2003-08-13 : 04:54:08
I suspect the windows login that you used to connect is either :

(a) the userid that runs the SQL service - check by getting properties of server in EM, go to security tab, and check out the bottom : it will either be a system account, or a specific domain account;

OR

(b) userid is administrator on the box, and administrator has not been removed from having SQL auth (as I recall, admin on box automatically get's SQL, unless you explicitly remove it).

*##* *##* *##* *##*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page
   

- Advertisement -