Skip to Content
author's profile photo Former Member
Former Member

SQL problem in HANA Studio CalculationView

Dear all,

I'm working on a simple SQL-statement in HANA studio for merging two tables. I'm using a SQL-script Calculation View and want to combine these tables. The structure of the two tables is the following:

Table A: ChangeDocument

ChangeDate DocumentNumber ObjectValue 2013-11-14 1123057768 OR006640028785 2014-12-11 1123057769 OR006640026776

...

... ...

Table B: ChangeLog

DocumentNumber ObjectValue OldValue NewValue 1123057768 OR006640028785 2014-01-02 2014-01-24 1123057769 OR006640026776 2014-02-11 2014-02-01 ... ... ... ...

I wrote the following SQL-Statement:

var_out = SELECT A.ChangeDate AS "ChangeDate", A.DocumentNo AS "DocumentNo", B.DocumentNo,

B.ObjectValue AS "ObjectValue", B.OldValue AS "OldValue", B.NewValue AS "NewValue"

FROM ChangeDocument AS A LEFT JOIN ChangeLog AS B

ON A.DocumentNo=B.DocumentNo

GROUP BY DocumentNo;


Unfortunately, I receive the following error, when I'm trying the excute the statement:

Deploy Calculation View: SQL: transaction rolled back by an internal error: invalid column name: A.DOCUMENTNO


I really appreciate your help.

Regards

Dirk

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 16, 2015 at 11:04 AM

    Hello

    Column names are case sensitive in HANA, if you use double quotes it forces the case, if you don't use them HANA converts identifiers into upper case.

    So to fix your problem, put double quotes around the column names.

    Michael

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Sorry, the columns are named correctly (DocumentNo). I made a mistake for the column names in the problem description.

      After putting the column names in quotes, I received the problem that "DocumenNo was definied ambiguously". I had to modify the SQL like the following in order to make it work:

      var_out = SELECT A."ChangeDate" AS "ChangeDate", B."ObjectValue" AS "ObjectValue",

      A."DocumentNo" AS "DocumentNo", B."OldValue" AS "OldValue", B."NewValue" AS "NewValue"

      FROM ChangeDocument AS A LEFT JOIN ChangeLog AS B

      ON A."DocumentNo"=B."DocumentNo"

      GROUP BY A."DocumentNo", A."ChangeDate", B."ObjectValue", B."OldValue", B."NewValue";

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.