• martin.edward (3/3/2010)


    Dear Experts ,

    I would like to do the following :-

    get the date out of a certain column in a table

    select docdate from tablename

    Check if the docdate is greater than todays date, if so display it

    end.

    I have tried using a while loop but it fails. It just picks one date only instead of all the dates in the table. This does not work

    WHILE (SELECT docdate FROM tablename) <> ''

    BEGIN

    SELECT @BATCH=docdate FROM tablename

    END

    Kind Regards,

    Try this:

    select

    docdate

    from

    tablename

    where

    docdate > getdate() -- includes time info

    -- docdate > dateadd(dd, datediff(dd, 0, getdaate()), 0) -- drops time portion from consideration, use one or the other.