Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

openquery in PowerBuilder datawindow?

Status
Not open for further replies.

yaho3

Technical User
Mar 2, 2012
3
SK
Does anyone know how to use SQL command openquery in PowerBuilder DataWindow -> Data source?
I try to write it this way but it does not work:
(Error meessage: The argument (RETRIEVAL_ARGUMENT) defined for the select statement was not referenced)

DECLARE @Sql VARCHAR(8000), @MO varchar(10)
SET @MO =: RETRIEVAL_ARGUMENT
SET @Sql = 'SELECT fields FROM table WHERE field IN '+ @MO
SET @Sql = 'SELECT * FROM OPENQUERY(database, ''' + REPLACE(@Sql, '''', '''''') + ''')'
EXEC(@Sql)

How to define the retrieval argument correctly?

Thanks.
Peter
 
You would be better off creating a stored procedure which returns the results from your select with the your retrieval parameter as an input. Then use the stored proc as the datasource for the datawindow.

Matt

"Nature forges everything on the anvil of time"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top