Solved

Error querying between dates with parameters

Posted on 2012-04-04
6
295 Views
Last Modified: 2012-06-21
I know, the title is hard to explain but I will try....

In SSRS 2005 I have a lenghty query that has paramters for a @startdate and an @enddate. I use this in the query in the where statement like

eventtime between @startdate and @enddate

If I run the query and get promted for the the @startdate and @enddate but it then fails with an error:

            An error occurered while executing the query.
            Conversion failed when converting the nvarchar value '04/01/2012' to data type int.

The query works fine if I declare the @startdate and @enddate and then
set the @startdate and @enddate with the same values in the query. But if I declare the then I don't get prompted.

Any ideas?
0
Comment
Question by:edrz01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37806761
Change the parameter type to date time in your report.
0
 

Author Comment

by:edrz01
ID: 37806789
Already is. The problem is when I test the query it fails, when I run from the preview it works. I need it to work within the query test first so i verify what information it is pulling.
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37807582
Are there other parameters?  Verify you're passing the parameters correctly and in the proper order.
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:edrz01
ID: 37807640
Thanks ged325, I have thoroughly done that before I posted.
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37807668
There's a parameter mismatch of some kind going on.  Can you post your parameters and the procedure?  Also did you confirm you're pointing at the right database?
0
 

Author Closing Comment

by:edrz01
ID: 37822936
ok
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question