• Richard Warr (6/19/2013)


    I ran the code and got:

    Msg 242, Level 16, State 3, Line 7

    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

    The statement has been terminated.

    That was in the INSERT rather than the SELECT though.

    Re-run the code with "set dateformat ymd" first