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)
 How do you find out OS UserNames?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-01 : 08:39:04
Andy writes "Hello,

Our application handles user security and ,therefore, all users connect to the database via one database login. This makes administration a nightmere as it is impossible to tie a process to a particular user.

Is there anyway of finding out what the operating system login of a user is in SQL Server 2000?

Many thanks,

Andy Savvides.

Halcrow."

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-08-01 : 08:49:10
Hi

Not unless your application figures it out and passes it in.

Damian
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-08-01 : 08:55:27
Or you change your application to use NT Authentication.

Go to Top of Page

sandesh_moghe
Constraint Violating Yak Guru

310 Posts

Posted - 2002-08-02 : 08:19:40
OR create your own user management

---------------------------
Sandesh - The Messanger
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-08-02 : 11:14:45
Write a little VB app to grab it and write it to a table. You'll need to use an API call a long the lines of........

In a module...

Declare Function GetUserName& Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long)


In a form...

''''Get NT user name using the windows API call
Dim s$, cnt&, dl&
cnt& = 199
s$ = String$(200, 0)
dl& = GetUserName(s$, cnt)

Me.txtUserName.Text = Left$(s$, cnt) 'setting User Name from NT login


i use this in a login form for one of our apps. Adapt as needed.

Paul
Go to Top of Page
   

- Advertisement -