We have an SSRS report that has been running perfectly at multiple sites for over a year. It calls a MySQL stored procedure and displays the results in a table. For one particular customer who just migrated to a new server, this report now only shows one row of the results. It's a row that's early in the results but not necessarily the first row (not sure that has any significance). Below are steps I have taken so far to troubleshoot.
- I've confirmed the procedure should return hundreds of rows by capturing the SQL via the slow query log, and running it directly on MySQL. So I've ruled out the data, the procedure, and the connection to MySQL.
- This report does have grouping which I thought may be an issue, so I created a new report that calls the same procedure without any grouping and I get the same results.
- As far as we know all other customers are using SQL Server 2008 R2, or 2016. This customer is using 2014. We have confirmed this customer does have all the latest SQL Server updates.
- We have many other reports built in a similar way that work for this customer
- We tried replacing the report RDL with another copy thinking it was perhaps corrupt
There has been one thing I've found to get all rows to show up. If I hard-code all parameters in the dataset, all rows will show up in the table. If any parameters are passed in (it doesn't matter which ones, or how many), only one row of the results shows up.
Dataset text examples
Displays one row
Call sp_report(?,?)
Displays multiple rows
Call sp_report('A','B')
These examples both return the same number of rows from MySQL according to the slow query log, but SSRS displays a different number of rows.
Any ideas would be much appreciated. I've been researching online and conducting many tests to try and figure this one out.
Example
Here is one of the stored procs. It's not too complex, but I've even been able to reproduce this with a much simpler proc with one param and selecting from a single table, and as mentioned above I can see that MySQL is returning all the data from the log.
CREATE PROCEDURE `LetgReport_MediaReport`(IN agnId int, IN sd date, IN ed date, IN settings TEXT(10000), IN incidentTypes TEXT(10000), IN filterNum int, IN filterNumTwo int) BEGIN Call CreateSsrsTempTable(); Call PopulateSsrsTempTable(filterNum, settings); Call PopulateSsrsTempTable(filterNumTwo, incidentTypes); Select Incident.IncidentID, Incident.ICR, Incident.ReportedDate, Incident.ReportedTime, Incident.IncidentType, Incident.AgencyID, IncidentSummary.Summary, Incident.Description, I_Address.AddressID As I_AddressID, I_Address.HouseNumber As I_HouseNumber, I_Address.AptNumber As I_AptNumber, I_Address.StreetName As I_StreetName, I_Address.StreetType as I_StreetType, I_Address.City as I_City, I_Address.State As I_State, I_Address.Zip As I_Zip, I_UnitType.Abbreviation As I_UnitAbbr, NI_Address.AddressID AS NI_AddressID, NI_Address.HouseNumber As NI_HouseNumber, NI_Address.AptNumber As NI_AptNumber, NI_Address.StreetName As NI_StreetName, NI_Address.StreetType As NI_StreetType, NI_Address.City as NI_City, NI_Address.State As NI_State, NI_Address.Zip As NI_Zip, NI_UnitType.Abbreviation As NI_UnitAbbr, Name.NameID, Name.MasterNameID, Name.FirstName, Name.MiddleName, Name.LastName, Name.DOB, Ncic_DetailCodes.Code as Sex, Name.Weight, Name.Height, Name.IsJuvenile, Name.IsDeceased, Name.DateOfDeath, NameInvolvement.ReferenceTypeID, NameInvolvement.CreateDate As ArrestedDate, NameReferenceType.ReferenceType As InvolvementType, Offense.OffenseID As OffenseID, Offense.Literal As OffenseLiteral, Offense.Statute As OffenseStatute, IncidentCharge.Chapter As IC_Chapter, IncidentCharge.Section As IC_Section, IncidentCharge.Subdivision As IC_Subdivision, IncidentCharge.ShortDescription As IC_Description, IncidentCharge.ChargeID As IC_ChargeID, User.LastName AS OfficerLastName, User.FirstName AS OfficerFirstName From Incident Left Join IncidentSummary On IncidentSummary.IncidentID = Incident.IncidentID Left Join NameInvolvement On NameInvolvement.IncidentID = Incident.IncidentID Left Join Name on Name.NameID = NameInvolvement.NameID Left Join NameAddress On NameAddress.NameID = Name.NameID Left Join Address As NI_Address On NI_Address.AddressID = NameAddress.AddressID Left Join IncidentLocation On IncidentLocation.IncidentID = Incident.IncidentID Left Join Location On Location.LocationID = IncidentLocation.LocationID Left Join Address As I_Address On I_Address.AddressID = Location.AddressID Left Join UnitType As I_UnitType On I_UnitType.UnitTypeID = I_Address.UnitTypeID Left Join UnitType As NI_UnitType On NI_UnitType.UnitTypeID = NI_Address.UnitTypeID Left Join NameReferenceType On NameReferenceType.ReferenceTypeID = NameInvolvement.ReferenceTypeID Left Join IncidentOffense On IncidentOffense.IncidentID = Incident.IncidentID And IncidentOffense.IsDeleted <> 1 Left Join Offense On Offense.OffenseID = IncidentOffense.OffenseID And Offense.IsDeleted <> 1 Left Join IncidentCharge On IncidentCharge.IncidentID = Incident.IncidentID Left Join IncidentOfficer On Incident.IncidentID = IncidentOfficer.IncidentID And IncidentOfficer.IsPrimary = 1 Left Join User On IncidentOfficer.EmployeeID = User.UserID Left Join nameDescription2 on nameDescription2.NameID = Name.NameId AND nameDescription2.CategoryID = 39 Left Join ncic_detailCodes on ncic_detailCodes.ID = nameDescription2.NCICDetailCodeId Where Incident.AgencyID = agnId And Incident.ReportedDate >= sd And Incident.ReportedDate <= ed And NameInvolvement.ReferenceTypeID In (Select parameterFields From SsrsMultiValueParameters Where parameterId = filterNum) And NameInvolvement.Private <> 1 And Incident.IncidentType In (Select parameterFields From SsrsMultiValueParameters Where parameterId = filterNumTwo) And Incident.IsSealed <> 1 And Incident.IsSensitive <> 1 And (NameInvolvement.IsSealed <> 1 Or NameInvolvement.IsSealed Is Null); Call DropSsrsTempTable(); END
SSRS
(not able to post Images yet I guess)
The query type of the dataset is "Stored Procedure" and the script I'm passing is "Call LetgReport_MediaReport(?,?,?,?,?,?,?)". On the parameters page I have each question mark mapped to a parameter that is defined on the report.