PHP | Problem -
[User Error] Couldn't run query (22007, 242, [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.01000, 3621, [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.): UPDATE "TenantApplication" SET "ClassName" = 'TenantApplication', "LastEdited" = '2012-01-13 00:11:38', "Created" = '2012-01-13 00:11:38' where "ID" = 460: [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.; [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.
29/05/2012 4:22pm
PHP | Solution - Anon Y.Mous
UPDATE "TenantApplication"
SET "ClassName" = 'TenantApplication'
,"LastEdited" = convert(datetime, '2012-01-13 00:11:38', 120)
, "Created" = convert(datetime, '2012-01-13 00:11:38', 120)
where "ID" = 460:
It is probably no longer relevant for the original poster, but I'll add this in case it helps someone else....
The implicit conversion of the dates defined as a strings will be affected by regional settings on the client PC (probably your webserver if are using PHP). It can be avoided by using the SQL convert() function with 120 in the 3rd parameter:-