Solved

Database error for insert statement from powerbuilder

Posted on 2008-10-28
5
890 Views
Last Modified: 2013-12-26
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
Comment
Question by:rakesh_rl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 22825051
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
 

Author Comment

by:rakesh_rl
ID: 22825262
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
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 22825291
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 22832190
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
 

Author Closing Comment

by:rakesh_rl
ID: 31510871
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question