Can somebody help to exec following SQL?

Database
Enthusiast

Can somebody help to exec following SQL?

Select * FRom T1;

Select PK
, InCol
, Substring(InCol From 1 For Position('|' in InCol)-1)
, Substring(InCol From Position('|' in InCol)+1)
From T1
;
.

When I execute the above query it is throwing error 2663: string subscripts out of bounds..

Can anybody suggest solution to execute the query sucessfully?
1 REPLY
Junior Contributor

Re: Can somebody help to exec following SQL?

Add a WHERE Position('|' in InCol) > 0
or use it within a CASE WHEN Position('|' in InCol) > 0 THEN ...

Dieter