January 20, 2005 at 6:49 am
I am working on a DB that will have a Default login account and will be accessed by 50 + users. Around 10 users will be able to update the DB and will be managed on the front end. I would like to be able to capture their Windows Login Name with an Insert/Update trigger and update an EditBy field. The DBA doesn’t want to add all of the users, so that is why I am trying to make it work with the default account.
Thanks
fryere
January 20, 2005 at 7:46 am
Not real sure what you want to do, but check out these commands (from BOL). Perhaps they'll give you some of what you're looking for!
SELECT SYSTEM_USER
GO
SELECT HOST_NAME()
GO
SELECT USER_NAME()
GO
January 20, 2005 at 7:55 am
John,
That gives me the database user, which all of the users will be using the same one. I would like to capture their Windows Login Name so the DB can somewhat track who is editing the records.
I can pass in the user name from the front end, but I was hoping SQL Server had an easy way to capture it.
fryere
January 20, 2005 at 8:01 am
(Try running the samples again--I edited my last post)
January 20, 2005 at 8:12 am
John,
Host_Name() comes the closest, but it only gives me the PC name.
Thanks for the responses.
fryere
January 20, 2005 at 1:12 pm
>> The DBA doesn’t want to add all of the users <<
If that is the reason you should think about using WINDOWS INTEGRATED SECURITY. Then just grant access to one windows group and make your users part of that group. Once you have that, suser_sname() will return exactly what you want.
HTH
* Noel
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply