cancel
Showing results for 
Search instead for 
Did you mean: 

HANA Studio - SQL -Trim functio

12-01-2017 9:38 PM
2743 views 1 comments
0 Likes
SAP Managed Tags
Subscribe

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

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member383962
Participant
0 Likes

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: