• Hi Christophe,

    The problem with the query you provided is related with the datetime datatype.

    The datetime can store dates from January 1, 1753 ...

    In the example the query tries to cast 0001-01-01T00:00:00 to datetime

    <LogUser>System</LogUser>

    <DeleteDate>0001-01-01T00:00:00</DeleteDate> <!--the year 0001 :) -->

    <ActorPersonId>1</ActorPersonId>

    To test this you can replace 0001-01-01T00:00:00 with the boundary condition e.g 1753-01-01T00:00:00 and that will work

    .. or 1752-01-01T00:00:00 that will fail.

    If you want to stick with the year 0001 you can use datetime2(0) instead datetime. The lower boundary for datetime2 is 0001.01.01

    ps. take the datetime2 precision into consideration.

    BOL:

    datetime: https://msdn.microsoft.com/en-AU/library/ms187819.aspx

    datetime2: https://msdn.microsoft.com/en-au/library/bb677335.aspx

    D.Mincic
    😀
    MCTS Sql Server 2008, Database Development