Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CURRENT_USER always returns dbo? 1

Status
Not open for further replies.

DatabaseDude

Programmer
Nov 7, 2005
112
US
I have SQL Server set up for logins via Windows authentication and "use trusted connection."

However, CURRENT_USER always returns 'dbo' rather than the person's true login name.

Any way to capture that value? Something differently I should be doing with connection string?
 
Cool, good to know that :)

That returns domain and username (example: 'ABC\myusername').

The login was added to the database as just the username with sp_grantdbaccess.

Code:
EXEC sp_grantdbaccess 'ABC\myusername', 'myusername'

Is there a related way of returning just 'myusername' rather than 'ABC\myusername'?

Thanks, really appreciate your help :)
 
I knew that trick, just wasn't aware of there maybe being something built-in to do it directly.

You're much appreciated :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top