1

Building a report in SSRS 2008. I need to capture the built-in User!UserId variable so I can use it in my dataset query. It is part of my report security. I have tried a couple ways, but niether worked:

DECLARE @currentUser varchar(30) =User!UserID 

and inline:

SELECT @retVal = COUNT(*)
FROM MySecurityTable
WHERE ExpirationTime > GETDATE() AND UserName =User!UserId
4

1 回答 1

9

创建一个隐藏报表参数@UserID 并将其默认值设置为=User!UserID

在数据集中使用参数 @UserID。

SELECT @retVal = COUNT(*)
FROM MySecurityTable
WHERE ExpirationTime > GETDATE() AND UserName = @UserID
于 2013-08-06T16:57:38.190 回答