• Jamie Longstreet-481950 (2/15/2011)


    I prefer something I can rely on to work for all cases with dates... my favorite is

    CONVERT(varchar(8),getdate(),112)='20110215'

    because it is easy to remember and there are not special characters and it is always numeric. Not so good if I need a time, but for many processes, (auditing aside) there is no need to check time.

    Looks familiar... I use format 112 a lot, too, but generally with char(8) rather than varchar(8). Is there an advantage to use varchar() that I'm missing? Or is it just one of those "depends" things?