PATINDEX Equivalent

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

PATINDEX Equivalent

Post by DeepakCorning »

Is there an equivalent for the MSSQL Patindex in Datastage?

Requirement is to convert like the following --


Source Target

ABC-DEF ABC
EFGHI-KL EFGHI
A-B A
-JKL NULL

(substring from 1 till it finds the first occurence of "-").

Thanks !!!
Thanks
Deepak Patil

Convince Them Confuse Them .. What's the difference?
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Use the index function to locate the first "-" character, then search the forum for one of many ways to extract a substring from a string.

Actually, the Field function is probably even easier.

Mike
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

Yes , I think I got it --

FIELD (COLUMN , "-" , 1) will solve it...
Thanks
Deepak Patil

Convince Them Confuse Them .. What's the difference?
Post Reply