SQL Server 2005 Reporting Services display function
Everyone,
I created a audit report to display users and their security roles. I found out today I need to display the actual sql command in my report region results. Does anyone know what function I can use to do such?Sonya
October 26th, 2010 2:18pm
You can write a dataset which creates the main data set sql in the string i.e. Select 'SQL' as SQL_STR and then map the result of this to a parameter of type text.
after the above display the parameter in the report region.
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2010 2:38pm
I get an error but not sure why I am getting an error. The syntax seems to be correct but it won't execute without erroring out.
DECLARE
@SQLSTR NVARCHAR(4000)
SET
@SQLSTR =
'SELECT d.name as [User], r.name as [Role], d.create_date, d.modify_date
FROM sys.database_principals AS d
LEFT OUTER JOIN sys.database_role_members AS rm on d.principal_id = rm.member_principal_id
LEFT OUTER JOIN sys.database_principals AS r on r.principal_id = rm.role_principal_id
WHERE r.type = ''R'')
order by r.name, d.name'
EXEC
(@SQLSTR)Sonya
October 26th, 2010 4:08pm
Why don't you try :
Select 'Your Sql' as SQLSTR
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2010 4:37pm
Thank you.Sonya
October 26th, 2010 4:46pm