Solved

Database error for insert statement from powerbuilder

Posted on 2008-10-28
5
867 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now