1. Greg Sola
  2. PowerBuilder
  3. Thursday, 6 July 2017 02:58 AM UTC

The BIT column in a datawindow is being returned as -1 when 1 and 0 when 0.  This has been occurring for me using PB 12.0 and now with the new PB 2017.  I am experiencing this in both SQL Server 2008 R2 and 2014.  Has anyone run across this before.  I am forced to either change the column to TINYINT or INT or put a CASE statement in the Datawindow such as "CASE WHEN MyBitColumn = 0 THEN 0 ELSE 1 END AS MyBitColumn"

Any help would be appreciated.

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 July 2017 04:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi Greg;

   Please let kme know if this works for you ...   

   If the value of the StaticBind DBParm is 1 (default), the SNC interface does not describe the columns and does not do any data conversion. As a result, a bit column with the value 1 displays as -1 in a DW. To work around this issue, set the StaticBind DBParm to 0, which enables the SNC interface to convert the data type correctly

Regards  ... Chris

Comment
  1. Andrew Barnes
  2. Friday, 7 February 2020 19:09 PM UTC
Thanks for the tip, Chris. We currently are on OLE DB and I was beginning to look at SNC when I ran into this same problem. After setting StaticBind to 0, bit columns were correctly returned as 1 instead of -1.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 7 February 2020 19:41 PM UTC
Hi Andrew .. that is excellent news!
  1. Helpful
There are no comments made yet.
Kim Berghall Accepted Answer Pending Moderation
  1. Monday, 19 February 2018 23:14 PM UTC
  2. PowerBuilder
  3. # 2

the easiest way is to change the SQL like this: mycolumn = cast(mycolumn as tinyint). That also fixes the issue of having a NULL value.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.