cancel
Showing results for 
Search instead for 
Did you mean: 

Column name and Table Name can they be same?

Former Member
0 Kudos

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

View Entire Topic
muthuram_shanmugavel2
Contributor
0 Kudos

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