Showing posts with label username. Show all posts
Showing posts with label username. Show all posts

Monday, March 19, 2012

Get UserName of Windows Account for Report Parameter

We would like to automatically pass the username as a parameter to reports. By username, I mean the username from the Windows account used to access the virtual directory containing the report (which uses Integrated Windows Authentication). Sort of like the User.Identity.Name property in ASP.NET. Is this going to be possible?

Thanks

Hi ALFKI.
Have you tried Globasl!UserID? ...or was it User!UserID?...damn, it slipped my mind; but I guess it'll help you.
Regards|||

User!UserID has the fully qualified user name, i.e. MYDOMAIN\MyUserName

HTH...

--
Joe Webb
SQL Server MVP


~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811

I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)

Monday, March 12, 2012

Get the User Name for a login user

Hi Guys,

How can I get the current loged in UserName in windows in MSSQL?

The problem is:

Users login into their PC (Windows Login)Enter a URL of the intranet applicationThey would then be able to access the web base application (Intranet)The web application has a string connection to make a connection to the databaseI want to have a Trigger for my "products" table so if the table is modified (Insert/Update) all those changes be entered in "products_Audit" tableNow on "products_Audit" table I have a field "ChangedBy" where I want to store the windows loged in User Name (SYSTEM_USER just return the Username for the SQL connection that the web application use)

I would really appreciate all your help and suggestions.

Regards,
Mehdi

Hello,

In case of IntraNet where directory security does not allow anonymous users, then you can retrieve domain user information.

dim user as string = Request.ServerVariables("LOGON_USER")

and pass this variable for your database action query.

Big Smile