• The conversion to INT may be part of the problem. But Convert(datetime, Convert(int, GetDate())) should deliver midnight tonight, not midnight this morning, so it's surprising you are getting any rows at all if tomorrow's row doesn't exist.

    Your description of what you want to do would require something like

    IF EXISTS(

    select 1 from Xlog where LogDATE >= cast(getDate() as date)

    )

    then PRINT 'Record already exists.' ;

    Or you can select the LogDATE using slightly different code from what you have tried:

    select top 1 LogDATE from Xlog

    where LogDATE >= cast(getDate() as date)

    order by LogDATE desc ;

    If there are any rows for today or later that will deliver you just one LogDATE (the latest in the table), even if you have 10 rows in the table with LogDate today or later. Change desc to asc to get the earliest LogDATE in the table that is today or later (if there is any such row).

    Tom