Sunday, May 30, 2010

String or binary data would be truncated.

Just helped a client to upgrade Primavera Expedition V7 to Primavera Contract Manager V12. Then my client reported to me they received the error below in random:

SQLServerException: String or binary data would be truncated.

Checked the JBoss log, I got the full error below:

2010-05-30 10:59:57,281 INFO [STDOUT] DatabaseMgrSessionBean.executeUpdate the update statement is : UPDATE rqch SET rqch.change_number = '00005', rqch.change_date = '2010/05/26' , rqch.title = 'CCO #04-R1 Berth 3 Loading Cage Roof', rqch.additions = 0.0, rqch.deductions = 2733.000, rqch.chng_master_key = '000XXJZEK2169000000000file', rqch.chng_sys_item_type = 'CO', rqch.created_system = 'WEB', rqch.last_edit_system = 'WEB' WHERE rqch.master_key = '00057KdEK1010000000000CPM0'
2010-05-30 10:59:57,296 INFO [STDOUT] ERROR - DatabaseMgrSessionBean.executeUpdate SQLException :
2010-05-30 10:59:57,296 ERROR [STDERR]
com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

After further analyzed the SQL statement, I found the title field in rqch table is too short (varchar(32)), I changed it to varchar(80), and "String or binary data would be truncated." error disappears.

No comments:

Post a Comment