Tuesday, July 22, 2014

SSRS DateTime parameter problem

I had no luck with a Google search on this so I'm going to document it.


I was developing reports in SSRS for SQL Server 2008 R2 that print based on a date/time stamp in SQL Server.  If that date/time stamp is passed to the report as a date/time parameter the report will work in Visual Studio, but fail in Report Manager.


I believe the reason for this is Report Manager cuts off milliseconds from the date/time parameter, causing the report to return no data, as the parameter no longer matches the underlying data.


To solve this I convert the parameter to string and render the date/time value in the underlying SQL view to also be string.  That way SSRS is matching two string parameters.


This is a workable solution and has proven reliable.  I suppose it's also possible to drop milliseconds from the date/time value in SQL but that may have problems of its own.

No comments:

Post a Comment