How do I use the GETUSERID() function?

  • I cannot find anything showing an example of how this function is used.

  • Are you attempting to use this in a piece of TSQL because I don't believe it's a built in function.

    there is a function for that in SSRS. If that's where you are trying to use this, you'd use it just like any other report function. Put it in a textbox or label and at run time it would populate with the currently logged on domain and user information.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • refer to the following msdn link.

    http://msdn.microsoft.com/en-us/library/aa337114(SQL.90).aspx



    Pradeep Singh

  • http://msdn.microsoft.com/en-us/library/aa337114(SQL.90).aspx

    --[Edit]--

    Heh, oops. Beat me to it.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Thank you for your replies! I appreciate any and all help!

    I was trying to use it in a Reporting Services report. I thought I could use it to get the Domain account of the user attempting to run a report. Then I want to compare the Domain account to data in a table that would then return the divisions that the user has access to and show only those divisions in a report parameter dropdown. I tried using SUSER_SNAME() but that gives me the account that the Data Source is using and that is not what I need. Is there a different function that I could use in the T-SQL code in the data set for my report parameter?

  • I'm guessing that unless your users are accessing the server directly, you aren't going to be able to extract this information in T-SQL. If you're going through an ODBC connection first and have a designated user for the datasource, I believe that's all SQL has access to. But then again, I'm not a Admin, so this question is a bit out of my realm.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • I believe you can do what you want with the User!UserID global variable...

    Create a Hidden Parameter of type string, call it LoginName for instance.

    for the default value select the radial button next to non-queried and enter =User!UserID

    Then you can use that LoginName parameter in your dataset that returns the values for your divisions drop down list.

    You just need to make sure the hidden LoginName param is above your divisions parameter in the parameters collection, so that it is evaluated first.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Luke - thank you!

    I will give that a try!

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply