Skip to Content

How to determine a HANA column datatype

Hi,

Is there a way to determine the datatype of a column, i.e whether it is an integer or datetime or numeric..etc?

Regards,

Sau-Boon

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Apr 28, 2016 at 04:58 AM

    Hello Sau-Boon,

    systems views (e.g. TABLE_COLUMNS, VIEW_COLUMNS) deliver that information in column DATA_TYPE_NAME.

    Regards,

    Florian


    tmp01.JPG (144.8 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 28, 2016 at 04:56 AM

    You can check from SYS.COLUMNS

    Regards,

    Krishna Tangudu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 28, 2016 at 05:00 AM

    Hi Sau-Boon,

    If you are using SAP HANA Studio, then expand Catalog folder > expand the schema where your table is there > context click on table and select Open Definition. It will show datatype of all the columns of the table.

    Regards,

    Rashmi


    Capture.PNG (8.3 kB)
    Capture1.PNG (5.7 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 28, 2016 at 06:38 AM

    I am trying to build a function to check for a column type.


    I have not finished this but it seems I can't put the SQL statement this inside a UDF. Any workaround?

    3> CREATE FUNCTION ISDATE (schema_string varchar(255), table_string varchar(255), column_string varchar(255))

    4> RETURNS found INT

    5> LANGUAGE SQLSCRIPT AS

    6> coltype varchar(255) := '';

    7> BEGIN

    8> SELECT DATA_TYPE_NAME FROM TABLE_COLUMNS

    9> WHERE SCHEMA_NAME = :schema_string AND

    10> TABLE_NAME = :table_string AND

    11> COLUMN_NAME = :column_string;

    12> found := 1;

    13> END;

    ODBC error [SQLExecDirect] S1000:1:7:[SAP AG][LIBODBCHDB DLL][HDBODBC] General error;7 feature not supported: Scalar UDF does not support SQL statements

    Regards,

    Sau-Boon

    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.