• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Error querying between dates with parameters

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
edrz01
Asked:
edrz01
  • 3
  • 3
1 Solution
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Change the parameter type to date time in your report.
0
 
edrz01Author Commented:
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
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Are there other parameters?  Verify you're passing the parameters correctly and in the proper order.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
edrz01Author Commented:
Thanks ged325, I have thoroughly done that before I posted.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
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
 
edrz01Author Commented:
ok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now