• wolfkillj (9/30/2011)


    I certainly sympathize with you for having to work with suboptimal requirements with no ability to change them!

    Do you really need the hyphen separators when you convert @inDDMMYYYYHHMMSS to @TextDate? If you leave them out, @TextDate will be in ISO 8601 basic format (YYYYDDMM, e.g., '20110930'). ISDATE() works correctly on character strings in ISO 8601 basic format (with or without time data) regardless of the DATEFORMAT setting.

    Actually, you could just go with full ISO 8601 format, thusly: '2011-09-01T13:37:44'

    From BOL:

    The advantage in using the ISO 8601 format is that it is an international standard. Date and time values that are specified by using this format are unambiguous. This format is not affected by the SET DATEFORMAT, SET LANGUAGE, of login default language settings.

    http://msdn.microsoft.com/en-us/library/ms180878.aspx#ISO8601Format

    Jason Wolfkill