• Mike Levan (12/17/2007)


    yeah my Fromdate is a varchar as i told you and now i tried doing cast(fromdate as datetime) i get hte result set ok but with an error message

    Msg 241, Level 16, State 1, Line 1

    Syntax error converting datetime from character string.

    Since the field is varchar, you might have some records that are not proper dates. You could try this to make sure they are dates

    SELECT

    fromdate

    FROM emp

    WHERE fromdate IS NOT NULL

    AND ISDATE(CONVERT(CHAR(10),fromdate,101)) = 0

    Greg

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.