• jerome.morris (8/21/2013)


    How do I get this to work ? I know the format is M/d/yyyyHH:mm:ss

    You think you know. Unless the file is produced by a device, it is almost given that there are bad dates in the data.

    Let's, you need to get a space in there, and then you can use convert with the correct format code (which you find in Books Online). The problem is getting the space in there. Hm, something like:

    substring(col, 1, charindex('/', col) + 4) + ' ' + substring(col, charindex('/', col) + 5, len(substring))

    Something like that. I did not test, I leave that to you. But those are the building blocks. Again, use Books Online to learn more about these functions.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]