1. Tim Bruce
  2. PowerBuilder
  3. Friday, 16 June 2023 13:08 PM UTC

PowerBuilder version: 2019 R3 Build 2779

SQL Server 2019

ODBC Driver 17 for Sql Server

Can you cast to XML in PowerBuilder?  This stmt crashes the IDE.  txt is a varchar(max)

SELECT cast(txt as xml)
into :ls_string
from documents
where doc_id = 18;

Thanks

 

 

Accepted Answer
Markus Eckert Accepted Answer Pending Moderation
  1. Wednesday, 21 June 2023 17:25 PM UTC
  2. PowerBuilder
  3. # Permalink
Then you're really only getting the first 32K with your SelectBlob. Since you're connecting with ODBC, have your tried if this helps? https://answers.sap.com/questions/9882522/selectblob-size-limit.html
Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 21 June 2023 18:40 PM UTC
Hi Markus;

That's why my RTE solutions always worked as I *never* used ODBC - only native DB drivers.

Also, way better performance & DML functionality using native drivers as well. Food for thought.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Tim Bruce Accepted Answer Pending Moderation
  1. Wednesday, 21 June 2023 17:29 PM UTC
  2. PowerBuilder
  3. # 1

PBMaxBlobSize in the pbodb.ini file was set too low.  once I bumped it up the text was no longer truncated 

No when i select the varbinary(max) into a blob variable and convert it to string the document is displayed as it should

Thanks everyone for your help especially Markus who provided a link with the solution!

 

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 22 June 2023 18:19 PM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.
Tim Bruce Accepted Answer Pending Moderation
  1. Tuesday, 20 June 2023 10:32 AM UTC
  2. PowerBuilder
  3. # 2

Thanks for your suggestion Markus.  when I use your select I still get only part of the richtext string

Comment
There are no comments made yet.
Markus Eckert Accepted Answer Pending Moderation
  1. Tuesday, 20 June 2023 07:01 AM UTC
  2. PowerBuilder
  3. # 3

Hi Tim

We're storing out richtext data in varchar(max) columns in SQL Server. (And access them with SelectBlob and UpdateBlob to circumvent the 64K limit)

If you're converting your varbinary(max) data into varchar(max) in SQL Server, is the result still a valid rtf string? If so, you should be access your data with:

SelectBlob convert(varchar(max), <column> )
into :<blob variable>
from <table>
where <whatever>

Regards,
Markus

Comment
There are no comments made yet.
Tim Bruce Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 16:04 PM UTC
  2. PowerBuilder
  3. # 4

Thanks Chris,

The IDE didn't crash this time but when I convert it to string I get ÿþ{

We're switching from Oracle to Sql server

We have richtext in a varbinary(max) field.  I need to get that out of the database and put it in a richtext control so the user can read it

When using oracle we selected the blob into a blob variable then convert it to a string with no issue

Now that we are in sql server it seems the text is being cut off for anything longer than 65535 chars.  At first I thought it was the string conversion in PowerBuilder but have since learned that it's a limitation of SQL server and the only way to get all the text is to cast it as xml.  I've confirmed this in Management Studio as well.

Casting it to xml causes the IDE to crash.  

 

 

 

Comment
  1. Markus Eckert
  2. Wednesday, 21 June 2023 11:49 AM UTC
If you have a 65+K RTF Blob, what do you get if you run Len( lb_blob ) and what do you get if you run Len( String( lb_blob ) )
  1. Helpful
  1. Tim Bruce
  2. Wednesday, 21 June 2023 12:02 PM UTC
len(lb_blob) = 32771

len(string(lb_blob)) = 16385



when I select datalength and len in sql server for that field I get 356008. Even when I cast it as varchar(max) I get 356008
  1. Helpful
  1. Tim Bruce
  2. Wednesday, 21 June 2023 13:27 PM UTC
I just tried that to no avail. I think the truncation of the richtext is coming from sql server as the same thing happens in Management Studio unless I cast it as xml. When i cast as xml in PB the IDE crashes. I wen back to our DBA team to see if they know how to increase the output
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 14:29 PM UTC
  2. PowerBuilder
  3. # 5

Hi Tim;

  Please try using a SelectBlob DML command instead.

HTH

Regards ... Chris

Comment
There are no comments made yet.
Tim Bruce Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 14:19 PM UTC
  2. PowerBuilder
  3. # 6

Yes I have also tried that and it still crashes. 

Comment
  1. Chris Pollach @Appeon
  2. Friday, 16 June 2023 14:33 PM UTC
Did you run the SelectBlob command into a BLOB variable?
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 13:22 PM UTC
  2. PowerBuilder
  3. # 7

Hi.

I wonder what datatype is returned by ODBC Driver 17. It may not a varchar... Have you tried to get the value using select blob?

Andreas.

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 21 June 2023 11:55 AM UTC
Hi Andreas;

I think as well that the issue could very well be ODBC related. I've never had any such data stream length issues using SS native DB client drivers.

Regards .. Chris
  1. Helpful
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.