If you copy a query out of an SSRS report and try to run it inside of SQL Server Management Studio, you get the an error:
SELECT DISTINCT dp.ServerName AS C070, sys.SiteCode, dp.SiteName as SN, dp.HasRelationship as DpGroupMember, dp.GroupCount as CountOfGroupMembership, dp.IsProtected as AllowFallback, dp.PreStagingAllowed as Prestaging, dp.IsPxe as PXE, dp.IsMulticast as Multicast, dp.HealthCheckEnabled as ContentValidation, dp.AddressScheduleEnabled as DpSchedule, case when dp.Communication = 1 then 'HTTPS' else 'HTTP' end as Comm, dp.InternetFacing as Internet, dp.RateLimitsEnabled as RateLimfrom fn_rbac_SystemResourceList(@UserSIDs) as sys join fn_rbac_DistributionPointInfo(@UserSIDs) as dp on sys.NALPath = dp.NALPath where sys.RoleName = 'SMS Distribution Point'
Msg 137, Level 15, State 2, Line 16Must declare the scalar variable "@UserSIDs".
To resolve this issue, place the following at the beginning of your query:
Declare @UserSIDs As Varchar(25); Set @UserSIDs = 'Disabled'