Skip to Content
avatar image
Former Member

How to declare a variable in sql script

Hi

How to declare a variable same as the table's column data type ..

Like I have a table employee and salary as a column

I want to create a variable salary_column salary as salary .

I have no idea what is the data type of salary ...

please suggest ..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 24, 2015 at 12:39 PM

    Hi Surya,

    You can easily find the data type for a column.

    Go to Catalog - Expand your Schema - Tables - Table name (Employee) - Right click - Open Definition.

    Once you know the data type you can declare it in sqlscript.

    Please refer the below link to have an example:

    Table Variable type definition.

    Regards

    Raj

    Add comment
    10|10000 characters needed characters exceeded

    • Have you considered to look for the syntax where it usually is defined? The documentation.

      It's built right into SAP HANA Studio and also available online.

      Just check the SQLScript documentation and you will find the syntax definition for how to define and use variables, structure programs and a lot more.