• You didn't seperate the date and time part with a space. And in the last part of your query you are using the "DATEPART(ss,...)" twice and you are also not seperating these two with a ".". This will result in a notation like "2013-08-29 14:04:5959" and that string cannot be converted to the datetime format of the variable.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **