Tokenise

Discussion forum about all things SqlBase or SqlTalk
FRBhote
India
Posts: 2221
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Tokenise

Post by FRBhote » 17 Sep 2021, 06:53

I have a field with

Z/N/2016062/11

in a table.

What would be the best way to get Z and N through a select statement?

@LEFT( B_REF, @SCAN( B_REF, '/' ) ) give me Z but how to get the N?

MattiU
Finland
Posts: 6
Joined: 21 Mar 2017, 06:16
Location: Helsinki, Finland

Re: Tokenise

Post by MattiU » 17 Sep 2021, 08:46

@LEFT( B_REF, @SCAN( B_REF, '/' ) ) || @MID( B_REF, @SCAN( B_REF, '/' )+1, 1 )
gives you ZN

FRBhote
India
Posts: 2221
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Tokenise

Post by FRBhote » 17 Sep 2021, 12:07

Unfortunately the lengths of the first and second tokens is not 1. @LEFT works for the first token, but @MID assumes the length of 1.

B/BB/2016057/42556

Return to “SqlBase General Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests