Search this insane blog:

Showing posts with label SQL Server 2005 SSRS. Show all posts
Showing posts with label SQL Server 2005 SSRS. Show all posts

Tuesday, August 31, 2010

Find your ReportServer Stored Procedures

Here is a source I found that will show you all the stored procedures that are stored in your SQL Server Reporting Services.

 

This is a staple for me!  It can get pretty crazy, not knowing what stored procedure goes to what report!

 

 

;
with xmlnamespaces (
default 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition',
'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' as rd
)
select  name,x.value('CommandType[1]','VARCHAR(50)') as CommandType,x.value('CommandText[1]','VARCHAR(50)') as CommandText,
        x.value('DataSourceName[1]','VARCHAR(50)') as DataSource
from    (select name,cast(cast(content as varbinary(max)) as xml) as reportXML
         from   NRDEV1.ReportServer.dbo.Catalog
         where  content is not null
                and TYPE = 2) a
cross apply reportXML.nodes('/Report/DataSets/DataSet/Query') r (x)
where   x.value('CommandType[1]','VARCHAR(50)') = 'StoredProcedure'
order by name

Thursday, June 24, 2010

SSRS multi-select (easy way!)

 

Open Visual Studio Business Intellegence Studio

Open an existing project or create a new project.

 

Select the Data Tab image
create new DataSet image
   
   

 

call this dataset Select:

Here is my select statement.
select * from (
select 'basket ball' as ball
union select 'baseball'
union select 'foot ball'
union select 'nerf ball'
) t where t.ball in(@ball)








Call this ddl_select (this will be the drop-down menu you need for the multi-select)









 









select 'basket ball'
union select 'baseball'
union select 'foot ball'
union select 'nerf ball'








if you have a debug table you want to test your values (see how they are written, here’s some code:









 









if object_id('admin_ssrs_log') is null 
  begin
    CREATE TABLE [dbo].[admin_ssrs_log] ([ssrsID] [int] IDENTITY(1, 1)
                                                        NOT NULL,
                                         [PageName] [varchar](255) NULL,
                                         [Username] [nvarchar](520) NOT NULL,
                                         [runDate] [datetime] NOT NULL
                                                              CONSTRAINT [DF_ssrs_log_runDate] DEFAULT (getdate()),
                                         [string] [varchar](max) NULL
                                                                 CONSTRAINT [DF_ssrs_log_string] DEFAULT ('none'),
                                         [Stored Procedure] [nvarchar](255) NULL) 
  end
insert  dbo.admin_ssrs_log (PageName,
                            Username,
                            runDate,
                            string,
                            [Stored Procedure])
values  (
         'test multi-select parameters', -- PageName - varchar(255)
         'domain\username', -- Username - nvarchar(520)
         getdate(), -- runDate - datetime
         @ball, -- string - varchar(max)
         '(code behind execution; no stored proc)'  -- Stored Procedure - nvarchar(255)








 









Now, create the multi-select drop down for “ball”









image









 









here you can select the options (but you aren’t done yet! the clincher is next):









image









 









The multi-select parameter is written but SQL Server needs it parsed in a certain way.









(oh my, this is soooo easy!)









 









1.  Go to your data tabl image









2.  Edit the dataset that needs the @ball parameter.









image









 









3.  Select the Parameters tab









image

















































































 









The key is to use the Replace function and the Join function









 









Chagne your value









from =Parameters!ball.Value









to     =Replace(Join(Parameters!ball.Value,", ")," ", "")









 









voila.  your multi-select will work every time!









 









 









helpful source (kinda obscure, but here it is)

Friday, May 7, 2010

Error: the encrypted value for the "logoncred" configuration setting cannot be decrypted

I got an error:

”the encrypted value for the "logoncred" configuration setting cannot be decrypted”
open cmd as Administrator
Navigate to: C:\Program Files\Microsoft SQL Server\90\Tools\Binn
RSKeyMgmt.exe should be in that directory.
type: rskeymgmt –d and it overrides the Reporting Services Management Console

Thursday, May 6, 2010

Merged Cells in Reporting Services

 
When a report with headers is exported to Excel, you will most likely get merged cells.

 mergedCells
This can mess up sorting inside your row data amongst other things.
[insert grumbling here]

How to enable SimplePageHeaders=True

A little Homework: Encryption Keys

Before you modify the xml file (.config file), you may stomp on the encryption data.

Encryption keys are based partly on the profile information of the Report Server service. If you change the user identity used to run the Report Server service, you must update the keys accordingly. If you are using the Reporting Services Configuration tool to change the identity, this step is handled for you automatically.

If initialization fails for some reason, the report server returns an RSReportServerNotActivated error in response to user and service requests. In this case, you may need to troubleshoot the system or server configuration. For more information, see Troubleshooting Initialization and Encryption Key Errors.

source: MSDN doc 157133

Ok… you ready to go ahead and modify the config file?

Modify RSReportServer.Config file on the server you need changing.  (do it locally to test first).

rsreportserver.config file location:
If you have a default installation , the location is C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer


Inside the file, look for Extension Name="EXCEL"

  1. back up your config file
  2. You will have to add a few tags inside the .config file.  Something like this:

config-file





Microsoft gives you a very nondescript article about Excel Device Information, but defines terms for you.


NO need to restart the file; it is an xml file.  source
source:

msdn article
msdn discussion site
one of my top discussion/content sites I love: simple-talk
Special thanks to Mike Schetterer MSFT

Tuesday, May 4, 2010

Monitoring all kinds of Reports


I got this from an article a while back and tweaked it a little.


If you want to view failed reports, you would run this:
SELECT
TOP 20
C.Path, C.Name, EL.UserName, EL.Status, EL.TimeStart, EL.[RowCount], EL.ByteCount,
(EL.TimeDataRetrieval+EL.TimeProcessing+EL.TimeRendering)/1000 AS TotalSeconds, EL.TimeDataRetrieval, EL.TimeProcessing, EL.TimeRendering

FROM ExecutionLog EL
INNER
JOIN
Catalog C

ON EL.ReportID=C.ItemID
WHERE EL.Status not
like
'rsSuccess'

ORDER
BY TimeStart DESC


Well, I found a lot of these nifty monitoring reports, so I made this script
DECLARE @query VARCHAR(max)
select @query='failed_reports'
-- change to 'recent' , 'active'...



IF(@query='recent')
SET @query='SELECT TOP 20 C.Path, C.Name, EL.UserName, EL.Status, EL.TimeStart, EL.[RowCount], EL.ByteCount, (EL.TimeDataRetrieval+EL.TimeProcessing+EL.TimeRendering)/1000 AS TotalSeconds, EL.TimeDataRetrieval, EL.TimeProcessing, EL.TimeRendering FROM ExecutionLog EL INNER JOIN Catalog C ON EL.ReportID=C.ItemID'


IF(@query='active')
SET @query='SELECT TOP 10 EL.UserName, Count(*) AS ReportsRun, Count(DISTINCT [Path]) AS DistinctReportsRun FROM ExecutionLog EL INNER JOIN Catalog C ON EL.ReportID=C.ItemID WHERE EL.TimeStart>Datediff(d, GetDate(), -28) GROUP BY EL.UserName ORDER BY Count(*) DESC '


 
IF(@query='popular_reports')
SET @query='SELECT TOP 10 C.Path, C.Name, Count(*) AS ReportsRun, AVG((EL.TimeDataRetrieval+EL.TimeProcessing+EL.TimeRendering)) AS AverageProcessingTime, Max((EL.TimeDataRetrieval+EL.TimeProcessing+EL.TimeRendering)) AS MaximumProcessingTime, Min((EL.TimeDataRetrieval+EL.TimeProcessing+EL.TimeRendering)) AS MinimumProcessingTime FROM ExecutionLog EL INNER JOIN Catalog C ON EL.ReportID=C.ItemID WHERE EL.TimeStart>Datediff(d, GetDate(), -28) GROUP BY C.Path, C.Name ORDER BY Count(*) DESC'

IF (@query='failed_reports')
SET @query='SELECT TOP 20 C.Path, C.Name, EL.UserName, EL.Status, EL.TimeStart, EL.[RowCount], EL.ByteCount, (EL.TimeDataRetrieval + EL.TimeProcessing + EL.TimeRendering)/1000 AS TotalSeconds, EL.TimeDataRetrieval, EL.TimeProcessing, EL.TimeRendering FROM ExecutionLog EL INNER JOIN Catalog C ON EL.ReportID = C.ItemID WHERE EL.Status not like ''rsSuccess'' ORDER BY TimeStart DESC'



print
(@query)

Thursday, April 15, 2010

SSRS: What reports do I have uploaded?


/*
this refers to a linked server called myServer
if you don't have a linked server remove the text "myServer."
*/
SELECT
CASE C_1.TYPE
WHEN 2 THEN 'Report'
  WHEN 3 THEN 'Resource'  WHEN 4 THEN 'Linked Report'  WHEN 5 THEN 'Data Source' ELSE 'unknown'
  END AS TypeOfReport,

C_1.ItemID,
C_1.Path,
C_1.Name,
C_1.ParentID,
C_1.Type,
C_1.[Content],
C_1.Intermediate,
C_1.SnapshotDataID,
C_1.LinkSourceID,
C_1.Property,
C_1.Description,
C_1.Hidden,
C_1.CreatedByID,
C_1.CreationDate,
C_1.ModifiedByID,
C_1.ModifiedDate,
C_1.MimeType,
C_1.SnapshotLimit,
C_1.Parameter,
C_1.PolicyID,
C_1.PolicyRoot,
C_1.ExecutionFlag,
C_1.ExecutionTime,
R.ItemID AS Expr1,
R.Name AS Expr2,
R.id,
R.primary_rs_reports_id,
R.ManagerViewOnly,
R.HasDollars,
R.add_date
FROM nrdev1.ReportServer.dbo.Catalog AS C_1
LEFT
OUTER
JOIN admin_primary_rs_reports AS R

ON C_1.ItemID=R.ItemID
WHERE
(C_1.Path LIKE
'/%')

Saturday, January 9, 2010

Storing your favorite, re-usable code in SQL Server (Create an Assembly)

http://msdn.microsoft.com/en-us/library/ms189524.aspx
I am parking this link here to get back to what I want to create.
Anyone have feedback with experience creating assembly, I'm all ears.

Monday, December 8, 2008

SSRS: What Reports do you have out there?

list all the reports you have on your server:

use ReportServer


select ds.name as datasourcename ,
ct.name as itemname ,
ct.path
from dbo.catalog ct (with nolock)
inner join dbo.datasource ds
on ct.itemid = ds.itemid
where type = 2
order by datasourcename ,
itemname

Friday, August 15, 2008

Reporting Services URL strings

If you want to pass settings through the string:


base string:
http://[servername/[report_servername]/"%2f" / receiving / "%2f"/[report name]

all strings are to be rendered:

1. render report (require) "&rs:Command=Render"

- turn off toolbar: "&rc:Toolbar=false"

- turn off parameter viewability: "&rc:Parameters=false"

- implement a string search on report: "&rc:FindString=SPKRI"

- send to a frames page: "LinkTarget=[window_name]" (or you can target a new window using LinkTarget=_blank)

- for each parameter fed into report: &[parameterName]=NumberOrTextWithoutQuote
-example: &receipt_order=RC00000306

- for concatenating parameters &r[parameterNmae]=NumberOrTextWithoutQuote&[parameterName]=NumberOrTextWithoutQuote