Solved

Database error for insert statement from powerbuilder

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
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.

840 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