Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Create Splitter Function in SAP HANA

$
0
0

Hi All,

 

I am trying to create a same below function created in MS-SQL in HANA. I not able to achieve this creation.

 

Can anyone please help me with converting the same into HANA.

 

MS-SQL Function

--------------------------

 

Create Function fnSplitter (@IDs Varchar(4000) ) 

Returns @Tbl_IDs Table  (ID nvarchar(100) COLLATE SQL_Latin1_General_CP1_CS_AS  )  As 

 

 

Begin

Set @IDs =  @IDs + ','

 

Declare @Pos1 Int

Declare @Pos2 Int

 

Set @Pos1=1

Set @Pos2=1

 

 

While @Pos1<Len(@IDs)

Begin

  Set @Pos1 = CharIndex(',',@IDs,@Pos1)

  Insert @Tbl_IDs Select  Substring(@IDs,@Pos2,@Pos1-@Pos2)

 

  Set @Pos2=@Pos1+1

  Set @Pos1 = @Pos1+1

End

Return

End

 

 

 

 

Thanks

Muralidhar


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>