1. John Bailey
  2. PowerBuilder
  3. Friday, 11 August 2023 18:44 PM UTC

Being unsuccessful executing SELECTBLOB dynamically (using PB2021 with MSSQL Server DB). 
The following in-line SQL code works:

blob  lblob
SELECTBLOB pdf_blob INTO :lblob FROM web_pdf_backup_images

WHERE backup_id = 102894 using it_DBTran;

Putting the above selectblob script into a string variable and execute immediate results in --
Microsoft OLE DB Driver for SQL Server Incorrect syntax near the keyword 'INTO'

Figure I need to use a cursor to bind the parameters so tried --

string ls_sql
 ls_sql = "SELECTBLOB pdf_blob FROM web_pdf_backup_images  where backup_id = 103272
 DECLARE cursor_blob DYNAMIC CURSOR FOR SQLSA ;
 PREPARE SQLSA FROM :ls_sql USING it_DBTran ;
 OPEN DYNAMIC cursor_blob ;
 MessageBox("Open Cursor", it_DBTran.SQLErrText)
 FETCH cursor_blob INTO :lblob ;
 CLOSE cursor_blob ;

This resulted in the error --
Microsoft OLE DB Driver for SQL Server Incorrect syntax near the keyword 'FROM'

After trying numerous variations, I decided to try getting a non-blob column using the above script
by replacing SELECTBLOB with SELECT and the column name and matching result vrbl.

This worked perfectly. So problem appears to be selecting the BLOB column dynamically.
Hopefully, someone can tell me how to get this to work, and then the next step which will be UPDATEBLOB.

 

John Bailey Accepted Answer Pending Moderation
  1. Monday, 14 August 2023 13:39 PM UTC
  2. PowerBuilder
  3. # 1

DBMS = "MSOLEDBSQL SQL Server"

My DBA informed me --

The only version of PB that can utilize MSOLEDBSQL v19 is PB 2022. (The latest version is 19.3.1, June 2023).
Older PB versions (only as far back to when the MSO driver was first supported in PB 2019 R3) can only use v18.
I am on PB2021.

If it is the driver, then I will need to use in-line with a case block until we upgrade.

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 11 August 2023 19:55 PM UTC
  2. PowerBuilder
  3. # 2

Hi John;

  Are you using the newest SS driver?

SQLCA.DBMS = "MSO"

Regards ... Chris 

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.