DATE PARAMETER QUERY

  • Hi

    Only been using Reporting Services 3 days so bare with me please.

    Using the following script to create a report

    SELECT crn + ':' + admission AS UKEY, [adm ward], INTMAN, INTMAN_DESC, admtype, ADM_TYPE_DESC, ADM_TYPE_GROUP, admdate_dte

    FROM vw_IXP_PSNEW_ADMS_AND_DIS

    GROUP BY crn + ':' + admission, [adm ward], INTMAN, INTMAN_DESC, admtype, ADM_TYPE_DESC, ADM_TYPE_GROUP, admdate_dte

    HAVING ( (admdate_dte >= @ADMDATESTART) AND (admdate_dte <= @ADMDATEEND))

    The Parameters of @ADMDATESTART and @ADMDATEEND are causing me problems.

    @ADMDATESTART shows 14/02/2011 00:00:00 on teh report which is OK.

    but

    @ADMDATEEND shows 20/02/2011 00:00:00 and I need it to show 23:59

    @ADMDATEEND seems to default to 12 am and thus not giving me a full days worth of data.

    Does anyone know how to corrcet this or a work around.

    Thanks in advance

  • try HAVING ( (convert(date,admdate_dte,101) >= @ADMDATESTART) AND (convert(date,admdate_dte,101) <= @ADMDATEEND))

    Or 103, depends your date encoding.

  • Thanks for your advice, I think that has sorted the issue. i changed your >= and <= to >= and <= and it seem sto have worked.

Viewing 3 posts - 1 through 2 (of 2 total)

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