all groups > sql server reporting services > june 2005 >
You're in the

sql server reporting services

group:

Use CurrentUser as a Parameter for a Stored Proc


RE: Use CurrentUser as a Parameter for a Stored Proc Sonali
6/21/2005 1:07:04 PM
sql server reporting services:
Instead, you can get login user's login directly from RSS. Gloabal variable
User!UserID returns domain\loginname.

[quoted text, click to view]
Use CurrentUser as a Parameter for a Stored Proc G. Ray Giacalone
6/21/2005 1:58:10 PM
The following will return the current login user's name through the Report
Services Properties Code tab:

'Get the current login user's name
Dim strCurrentUser As String
Dim ident As System.Security.Principal.WindowsIdentity =
System.Security.Principal.WindowsIdentity.GetCurrent()
strCurrentUser = ident.Name

Is there a way I can pass this as a parameter into a MS SQL Server 2000
stored procedure for one of my Reporting Services data sets?

Thanx!


Re: Use CurrentUser as a Parameter for a Stored Proc Bruce L-C [MVP]
6/21/2005 3:12:25 PM
Is there a reason you don't just use the User!UserID global variable.
Regardless, you do it the same way. Create a query parameter, then click on
the ... and go to the parameters tab. If it created the report parameter for
you, you want to map the query parameter to an expression rather than to the
report parameter. In the expression either call your code or use the User
global variable. If using the user global variable then the expression would
look like this:

= User!UserID

Note that this includes the domain so if your stored procedure doesn't want
it then you need to strip it off.

Also, in layout view, menu Report->Report Parameters and remove the report
parameter created automatically for you when you put in the query parameter.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

AddThis Social Bookmark Button