Results 1 to 4 of 4

Thread: Dateadd in RS

  1. #1
    Join Date
    May 2003

    Dateadd in RS


    Hope someone can help.

    I've got to produce a report that filters information dependent on the purchase date based on various parameters.

    The parameters are:

    @yearend (Datetime)

    the script that I wrote in SQL is

    select assetno from assets where purch_date < = dateadd(mm,-@months, @yearend)

    but when I try to use this in the dataset it comes up with the following error:

    "Application usess a value of the wrong type for the current operation"

    Any help would be very much appreciated.

  2. #2
    Join Date
    Sep 2002
    What's data tpye of purch_date? How does the value in it look like? How does @yearend look like?

  3. #3
    Join Date
    May 2003

    Purch_date is a datetime format, example = 2005-02-07 00:00:00.000

    @yearend is a parameter set to datetime format and looks the same as above.

  4. #4
    Join Date
    Sep 2005
    USE the following to determine if there are records in assets
    table having purch_date in wrong format (that would be very very strange)

    SELECT * FROM assets WHERE ISDATE(purch_date) <> 1

    if the above statement returns rows, then there is a problem with data of table.

    you could use the following query to retrieve the records,
    you are looking for:

    select assetno from assets where DATEDIFF(dd, purch_date, dateadd(mm,-@months, @yearend) ) > = 0


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts