Skip to Content
avatar image
-1
Former Member

HANA Studio - SQL -Trim functio

Hi There,

I'm new to HANA Studio Sql. I'm trying to trim a column and export results to excel.

I used Trim(' ', Col1) "Col1" in select.

I then Export Result

Open in excel using "From Text" open in the Data Tab. Choose ' delimited. But still see the trailing blanks.

I just want the trim result.

Thanks,

Meena

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 04, 2017 at 05:35 AM

    Hi @Meenakshi Jayachandran

    This is an example of what you need to do:

    To create a table:

    create column table "KABIL_PRACTICE"."TEST_EXP"
    (
    "ID" integer,
    "Name" Nvarchar(10)
    );
    

    To insert a value into a table:

    insert into "KABIL_PRACTICE"."TEST_EXP" values (1,' kabil'); -- the Name column contains blank space in front of the name
    insert into "KABIL_PRACTICE"."TEST_EXP" values (1,' Arasan');
    insert into "KABIL_PRACTICE"."TEST_EXP" values (2,'kabilan')
    

    Result:

    Try this code:

    select trim (leading ' ' from "Name") from "KABIL_PRACTICE"."TEST_EXP"; -- here Name is a Column name

    Result:

    and Export the result.

    and from your excel open it by navigate Data -> From text to the source file of the saved results it's like to be shown as below:

    Add comment
    10|10000 characters needed characters exceeded