Skip to Content

Using [%1] on a view using HANA

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 19, 2016 at 04:06 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.