[PeopleTools] Using SQLExec or Fetch with Common Table Expression Fails
PeopleTools: 8.53
Database: Microsoft SQL Server 2008
If I execute the following sql
Local string &EMPLID;
SQLExec("WITH CTE(EMPLID) AS ( SELECT EMPLID FROM PSOPRDEFN WHERE EMPLID <> ' ' ) SELECT TOP 1 * FROM CTE", &EMPLID);
MessageBox(0, "", 0, 0, "Emplid is: " | &Emplid);
I get the error message
SQLExec: 1 select list items in parameter list, but SQL has 0 select columns. (2,124)
If I use CreateSQL and Fetch, it connects but returns no rows (it says connection not open when I try to close)
Is there any way to convince PeopleSoft that this is a valid expression?
Actual Issue:
I have a much more complicated CTE that I'd like to use that takes paramters and returns multiple values, but runs into the same issue.