Skip to Content

HANA Studio - SQL -Trim functio

Dec 01, 2017 at 08:38 PM


avatar image
Former Member

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.



SQL | trim
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Kabilarasan R 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')


Try this code:

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


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:

capture.png (3.6 kB)
r1.png (5.2 kB)
e.png (2.4 kB)
10 |10000 characters needed characters left characters exceeded