1. Tim Bruce
  2. PowerBuilder
  3. Thursday, 2 February 2023 14:08 PM UTC

Hello,

We're using SQL server and I'm looking to call a db function in embedded sql

string ls_is, ls_name

select dbo.PKG_UTIL.RETURN_NAME(:ls_id)
into :ls_name
using sqlca;

I get a syntax error.  

 

John Fauss Accepted Answer Pending Moderation
  1. Thursday, 2 February 2023 14:25 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Tim -

SQL issued from PB works a little differently than SQL issued from SQL Server Management Studio. SQL SELECT statements issued from PB require a FROM clause.

Try this:

SELECT dbo.PKG_UTIL.RETURN_NAME(:ls_id)
INTO :ls_name
FROM (SELECT a=1) AS tmp
USING SQLCA;

Helpful Tip: In the future, it would be beneficial for those of us that are not in front of your monitor to know the actual error message you are experiencing, as well as the version of SQL Server and PowerBuilder when you are having DB-related issues.

HTH, John

Comment
There are no comments made yet.
Tim Bruce Accepted Answer Pending Moderation
  1. Thursday, 2 February 2023 14:30 PM UTC
  2. PowerBuilder
  3. # 2

That worked, thanks!  I'll post the versions next time around.  As for the error "Error  C0031: Syntax error" was the actual error 

 

Thanks again

 

Tim

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.