Skip to Content
0
Former Member
Feb 10, 2015 at 03:44 AM

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

465 Views

My PB 10.5 app is connecting to a Microsoft SQL Azure cloud database via ODBC. I am getting the following error:

[Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string.

Here is the dbtrace entry:

(5a913c0): update WS_FILECONTENT SET FILESIZE =641 , ZLIBSIZE =180 , FILEDATE ={ts '2015-02-10 03:11:45.507000'} WHERE ID =1 (290.509 MS / 4379.111 MS)

Here is the inline SQL statement:

UPDATE WS_FILECONTENT

SET FILESIZE = :ll_length,

ZLIBSIZE = :ll_zlength,

FILEDATE = :ldt_filedate

WHERE ID = :al_contentid;

The column FILEDATE is defined as datetime. I could change the datatype to datetime2 but that would mean that all the datetime columns in the database need to change.

Is there a way to tell PowerBuilder to only pass 3 decimal places for the seconds?