cancel
Showing results for 
Search instead for 
Did you mean: 

Using [%1] on a view using HANA

pm_witmond
Participant
0 Kudos

Hi,

The query below is working fine under SQL but we can't find the correct HANA syntax

SQL SYNTAX

/*SELECT FROM [dbo].[OPRJ] T0*/

declare @PrjCode as nvarchar(40)

/* WHERE */

set @PrjCode = /* T0.PrjCode */ '[%0]'

select * from [dbo].[SW_Data_Store] T0  where T0.PrjCode=@PrjCode

HANA VERSION

/*SELECT FROM [dbo].[OIGE] T0*/

SortNr nvarchar(40);

/* WHERE */

SortNr: = /* T0.U_SortNr */ [%0]

SELECT SortNr from sortingresult where U_SortNr=SortNr:

The HANA version seems to work for the first part, we get a drop down with values. But the final select statement  doesn't work at all

Who can help us ?

Thanks,

Paul

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

The reason why this only works on SQL Server is that this is SQL Server language - not standard SQL.

From the code you posted, I infer that you want a simple SELECT query with a parameter - correct?

If so, you should try something like

SELECT "SortNo"

FROM SORTINGRESULT

WHERE U_SORTNO = ?;

HANA studio will ask you for the value of the placeholder (?) upon query execution.

If you actually wanted to create a stored procedure, then this is easily possible too.

Just read the documentation on how to write SQL Script code and you're good.