on 09-14-2016 7:39 AM
Hi Experts,
I am learning on Join types is SAP HANA Modeling.
Created a "State" table with State and Sname as below
State
State Sname
MI MICHIGAN
AL ALABAMA
Now when I am writing a SQL SELECT Sname from "State" , It is working fine. But when I give
Select State from "State" it is saying invalid column name.
So if table name and Column cannot be the same why is it allowing while creating the table.(I uploaded a csv file data and created this table)
Am I missing some settings/some thing some where. Searched for this error but didn't get any answer. hence posting it.
Thanks in Advance.
Regards,
Archana
Hi Archana,
Table_Name and It's Column_Name could be same. No Issues on that.
HANA Column names are case sesitive. You are getting invalid column name error becasue of it.
Upper Case Column Names:
If tables have been created using below queries,
Column names will be in Upper case [This is recommended format].
i. Create Column table STATE (STATE Varchar(2), SNAME Varchar(10));
ii. Create Column table STATE (State Varchar(2), SName Varchar(10));
Both Select Queries will be working fine in this case.
i. Select STATE, SNAME From STATE;
ii. Select State, SName From STATE;
Lower Case Column Names:
If table have been created below query (Column names mentioned in double quotes),
Column name will be in Lower case.
Create Column table STATE ("State" Varchar(2), "SName" Varchar(10));
i. Select "State", "SName" From STATE --> Will work
ii. Select State, SName From STATE --> Invalid column Name Error as It looks Upper case column names.
Regards,
Muthuram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You Arden and Muthuram.
I get it.
It worked when I gave the query as
select "State" from "State"
Regards,
Archana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Archana
I maybe wrong but I think it should still work, you could try a few variations as per below
select "STATE" from "STATE"
select "STATE" from "YOUR_SCHEMA_NAME"."STATE"
Let me know how you get on
Regards
Arden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.