Poison
Poison

Reputation: 11

How to pass date parameter from ssrs report to query.commandtext as sql query

I am trying to set an expression for command text like this:

="Database.dbo.pPROC 'FirstParameter', " + IIf(Parameters!Date.Value="","null", CDate(Parameters!Date.Value) )

and as a second parameter i need to pass Date/Time parameter from my report (Parameters!Date.Value) to execute procedure. The second parameter in sql has a smalldatetimeformat (f.e 2018-08-01 00:00:00).

Command works when I do not choose date (null) but when I want to choose date in report I have got an error as output:

"Error during processing of the CommandText expression of dataset ...."

Thank you

Upvotes: 1

Views: 1028

Answers (1)

Wolfgang Kais
Wolfgang Kais

Reputation: 4100

Don't make things too complicated.

Instead of building a expression for the command text, chose Stored Procedure as the Query type. On the Parameters page of the Properties window, you can map the parameters of the stored procedure to report parameters or expressions.

Upvotes: 1

Related Questions