• How did you get the code 111 for CONVERT? That's completely wrong for YYYY-MM-DD. You could use code 120 or 121, however, that's an ISO stardard format so you shouldn't get those issues.

    For a better reference on CONVERT codes for datetime values, check Books On Line: http://msdn.microsoft.com/en-us/library/ms187928.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2