DateDiff issues

  • I need to get the month difference between two dates. I am using the syntax found in this thread http://www.sqlservercentral.com/Forums/Topic629654-150-1.aspx. This same syntax is suggested all over the place, but I am still getting an error that "Argument 'Interval' is not a valid value". The syntax I am using is datediff("Month", Fields!PrevExpDate.Value, Now)

    HELP! Thanks,

    Eva

  • Try taking the double quotes off of Month, ie datediff(MONTH,Fields!PrevExpDate.Value, Now)

  • Doing that gives me the same error messages as mentioned in the earlier thread. That fails.

  • evaleah (6/29/2009)


    Doing that gives me the same error messages as mentioned in the earlier thread. That fails.

    Well, I don't do much with RS at the moment, but what I suggested was based on reading BOL (Books Online). If I find anything new, I'll pass it on.

  • The documentation on that is wrong. There are posts about that all over the internet. At any rate I realized I had spent a ridiculous amout of time on this and all I had to do was do the math in the query. So, that's what I did.

  • I'll keep that in mind as we move more reports to RS. It is info that will probably come in handy.

  • The DATEDIFF function in Reporting Services is not the same function we have in SQL Server. It is the equivelant VB.NET function. Although it does work the same, it needs to be called just a bit differently.

    =DATEDIFF(DateInterval.Month, Fields!PrevExpDate.Value, Today());

    The difference is how you reference the interval value. You need to pass into the function the correct value and the easiest way to get that is to use the DateInterval object.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply