Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 926
  • Last Modified:

Database error for insert statement from powerbuilder

I have an insert statement from powerbuilder, that is throwing a database error. This started happening after PB9 to PB11 migration of the application. It was working fine in PB9. Does it have anything to do with OLE? Please find the attached file. The SQL was working perfect in PB11. Although the message says "String or binary data would be truncated", its not exactly that I guess, I  checked all the field length and datawindow column length (from which the stmt get the values through getitem) and none of them exceeded the char lengths.
Error.bmp
0
rakesh_rl
Asked:
rakesh_rl
  • 2
  • 2
1 Solution
 
Daniel WilsonCommented:
I would double-check the field lengths against the lengths in the query.

Assuming that passes very rigorous inspection, see if there's an INSERT trigger on the table.  If so, is it doing an INSERT or UPDATE?  A failure in that trigger would fail your insert statement.
0
 
rakesh_rlAuthor Commented:
I have checked the field lengths, but will check again for you.
if you look at the error screen shot, there is a date field, the second one in the insert statement. the data type is datetime for that but looks long. The error I captured from PB, the driver is OLE DB.
Yes, there is an insert trigger that updates the user name and timestamps into the device_hist table.
0
 
Daniel WilsonCommented:
You might try copying the query into SSMS and changing that date to get rid of the TS.  the time on the end should go fine into a DateTime field.

It's also worth checking the field lengths on the device_hist table to see whether the username going in there might be too long.
0
 
sandeep_patelCommented:
If you still have PB9, check the exact sql being executed for datawindow in datawindow's sqlpreview event. compare both sql and you will know the reason.

Regards,
Sandeep
0
 
rakesh_rlAuthor Commented:
It was pure trucation of one of the codes, location code. on second look, I found that! Thanks. It was pretty straight forward.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now