Crystal Reports - how do I find which reports are being used? - sql

I need to find out which of our Crystal Reports users are actually running, so we can get rid of those that are no longer being used. I can do some kind of query of the latest jobs run on the SQL server as described here:
How to get the last run job details in SQL
However I'm not sure how I could tie that back to the actual reports. I've tried opening a Crystal Report in Crystal Reports 2008 while running a trace on the SQL server using SQL Profiler, however I don't see any database calls in the tracethat would allow me to determine the name of the report being run.
How could I find out which Crystal Reports are actually in use?

I usually embed a unique identifier (the report's name or ID) in either a sql-expression field or the command's query.
If the DBA finds an issue with a given query (e.g. non-performant), this approach easily identifies the source.
SQL-expression:
//{%report_name}
(
'Daily Obstetrics Review [OB003]'
)
In the command:
SELECT 'Daily Obstetrics Review [OB003]' AS REPORT_NAME
...
FROM ...

Related

TFS SQL Server Report builder - Trouble finding Test plan ID parameter syntax

Modifying canned TFS reports with default values for date, iteration and Test Plan (for embedded burndown reporting against a specific project)
Another article on this site led to a great report to pull the IterationID syntax that is needed within the parameter field (AreasAndInterations.RDL on OneDrive).
I'm trying to locate a similar report (or a query) that will provide the syntax and values needed for a default "Test Plan" to load within the RDL report.
Thanks!

Scheduled report remain in pending status

I have created SSRS report. Its working fine when I try to view this report on report server.
Now I am trying to use Subscriptions feature of Report Server to export report's in PDF format on schedule basis. For that.
I created New Subscriptions for some of the reports, and I scheduled the reports using shared schedule. The scheduling is working fine.
The issue is with the status of the report subscriptions under subscription tab, it shows
"Failure writing file \viaserver\Shared\Test.pdf: An impersonation error occurred using the security context of the current user"
Have you checked data source setting of the report, and whether the RS execution account has permission to write file at "\viaserver\Shared\"?
Hi Raju
The problem could be a bit complicated as you do not have the log for the report. So just some general suggestions, hope they can help you:
To check whether the whether the report ran successfully within the subscription, you can query executionlog2 in the report server database, by default the query should be like:
select * from ReportServer..ExecutionLog2 where RequestType = 'Subscription'
Instead of generating PDF subscription, can you run the report directly? Or is this report very large? It is because when generating report into pdf format, paginating can consume resource a lot. If you reduce the report size, can subscription run successfully?
The RS subscription relies on SQL Agent, can you find out whether the SQL Agent job ran successfully? To find out the job related to the subscription, you can use below query, where the scheduleID column is what you need to locate the job:
use ReportServer
go
SELECT S.ScheduleID AS SQLAgent_Job_Name
, SUB.Description AS Sub_Desc
, SUB.DeliveryExtension AS Sub_Del_Extension
, C.Name AS ReportName
, C.Path AS ReportPath
FROM ReportSchedule RS JOIN Schedule S ON RS.ScheduleID = S.ScheduleID
JOIN Subscriptions SUB ON RS.SubscriptionID = SUB.SubscriptionID
JOIN Catalog C ON RS.ReportID = C.ItemID AND SUB.Report_OID = C.ItemID
WHERE C.Name LIKE '%%'
Here are some additional points to help you debug the issue; I ran into many of these issues today - using SQL 2016 on Server 2012 R2. I'm writing this up mainly for my own reference but in hopes that (a) it will help someone else, and (b) someone can give additional info as to what is happening.
We have a domain set up, and I was trying to use a domain account as the account to impersonate. Use a local account. The account should have logon rights.
Set up a share. Only UNC paths are allowed, so be sure that the user set up in the previous bullet point has (a) NTFS folder permissions and (b) share permissions. These are 2 separate things. Do this even if the share is on the local machine.
I like to stop reporting services, rename the log file in <drive>\Program Files\Microsoft SQL Server\MSRS(SSRS version).MSSQLSERVER\Reporting Services\LogFiles\, then start it again so there's a fresh file and you're not scrolling down to the bottom of a 5MB file.
Sacrifice something - an animal, your first born - to the SQL Server Reporting Services gods. We're still trying to determine what happened, but at this stage we get the PDFs to generate to a local folder but it still writes out each one having an error, same errors that we were getting when it wasn't writing out the PDFs. It is writing out the PDF files. I do not know why it also writes out the same error as it was when it was failing to write out each PDF, I am thoroughly confused, and so is SSRS, apparently. I'll be sure to update this with additional info as we figure this out, but it's definitely not the easiest MS product we've had the pleasure of dealing with.

Add exsiting query to report

My report calculates the stock of inks in my stores. I built a SQL statement in VB.NET and got the correct results. How can I display these results in my Crystal Report? Or design a report such that same results will be retrieved?
I tried to use SQL Expression builder but failed.
Usually you will link Data Tables to your report using Database Expert. Do the same in Database Expert, select the Database and you can see Add Command. Select that and click the > button. You will get a Window, write your SQL Query there and press OK.
After finishing this you can see Command in Database Fields which contains all your records got from the SQL Query as result.
In Database Manager choose Add Command and then type your SQL Statement there.

Crystal Report Duplicating in details?

so I have a template in Crystal reports using vb.net, I changed my data source location and that source still contains the needed tables for my report, the problem is this... My original template displays the exact report but when I changed its data source it duplicates the data in the details section(e.g I made a query that will show 1 item only,but instead I get 4).
Here is a screenshot of my problem:
(original at http://tinypic.com/r/5by6ih/5)
I want to alter the template rather than to make another one
This is normally down to an issue with the underlying SQL query. If you open the the report in Crystal (or visual studio) you should be able to "Show SQL Query". Run the query in Query Analyser or SQL Server Management Studio and look at the result.
If the underlying reason isn't then immediately apparent please paste the resulting output.

Crystal reports not pulling same data as sql server

I have the following code:
select order_number,received_date
from order_head
where order_head.order_number not in (select order_number from csa_log group by order_number)
and ordernature in ('02','03')
and received_date > '01.01.2010'
and buyer_code = 'GAP'
group by order_number,received_date
order by received_date desc
When run in crystal reports does not pull the same data as sql server express. It is pulling only one record as opposed to 7. Anybody have some insight? Thank you in advance. (I have a suspicion it has something to do with the nested statement).
Several possibilites come to mind.
First are you absolutely sure that Crystal Reports and the database you are querying are the same one. Amazing how often one is querying dev and another prod when you have these kinds of issues. Even if you don't believe this to be the case, check this anyway.
Permissions could be another reason for the discrepancy.
Finally confirm that the two queries are exactly the same. Use Profiler if possible to confirm this.
Usually I use SQL server profiler to check what SQL Statements Crystal is running behind the scenes. In your case is not possible because you are running SQL Server Express.
In Crystal you have the option of checking the actual SQL statement that Crystal is running by selecting "Database" and "Show SQL Statement" in the top menu.
Make sure that under Reports menu you are not putting any conditions in the Select Records.
Check that you are showing the fields in the detail and not in the header or footer. That is a common mistake.