Solved

Database error for insert statement from powerbuilder

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

752 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