• tt-615680 (9/3/2015)


    CONVERT(date, col1) AS 'DateTimeStamp', is the line I've chabged unless I need to change it to something else?

    and I get the following error:

    Conversion failed when converting date and/or time from character string.

    Thank you!

    The first lesson of course 101 for SQL Server goes something like this: "Look at the data". That's what I'm asking you to do. Look at the first column of the output, the column which you are attempting to convert to a date, and report back in general terms what you see. Is all of it/some of it/none of it convertible to datetime? You don't have to look at every row, just a sample. If it's not too tough, copy and paste a few samples up here.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden