COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: ssrs2cognos on 20 Dec 2017 02:18:39 PM

Title: Problem calling SQL server stored procedure with datetime parameters
Post by: ssrs2cognos on 20 Dec 2017 02:18:39 PM
I have a stored procedure dbo.MySp(@From datetime, @To datetime)

In Analytics, I created a report, added a prompt page, created two "Date and time prompts " and named them Param_From and Param_To.

In SQL object, I set SQL syntax to "Pass-Through" and use this code

exec dbo.MySp #sq(prompt('Param_From','date'))#, #sq(prompt('Param_To','date'))#

it WORKS, but it ignored the time portion of the "Date and time prompts".

if I changed the code to

exec dbo.MySp #sq(prompt('Param_From','datetime'))#, #sq(prompt('Param_To','datetime'))#

then I get error UDA-SQL-0564 [Microsoft OLE DB Provider for SQL Server]Error converting data type varchar to datetime. (SQLSTATE=22018, SQLERRORCODE=8114)

I can't even pass validation. Aren't both Date and Datetime valid datatypes?