Solved

Error querying between dates with parameters

Posted on 2012-04-04
6
289 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
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

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

Author Comment

by:edrz01
Comment Utility
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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
Are there other parameters?  Verify you're passing the parameters correctly and in the proper order.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:edrz01
Comment Utility
Thanks ged325, I have thoroughly done that before I posted.
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
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
Comment Utility
ok
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now