Split a string parameter in a stored procedure

Database

Split a string parameter in a stored procedure

I have a stored procedure with a input string parameter. This parameter will be used in the select statement where condition in the stored procedure.

It will like select * from tablexyz where customer id IN(@Parameter).

This parameter value will be with a list of customer id's separated by comma delimiter.

Ex: Customer id parameter value will be C5456, D7689, E78778, V87789, S8789

This parameter is passed as string to the stored procedure and it need to split the string parameter in the where condition so that the stored procedure fetches thd data for the required customer id's.

Any help on this is appreciated.

4 REPLIES
Senior Apprentice

Re: Split a string parameter in a stored procedure

Re: Split a string parameter in a stored procedure

Thanks Dieter...I worked..

Teradata Employee

Re: Split a string parameter in a stored procedure

Hi 

i wanna split data like 

'COUNTY_NUMBER|ISO_STATE_NUMBER|BEGIN_EFFECT_DT|CITY|ZIP_CODE|PARTITIONING_KEY|LOADEVENT_ID|' into multple columns 

 

Data will not be consitent 

 

can you help ?

Senior Apprentice

Re: Split a string parameter in a stored procedure

You might do StrTok(col, '|', n) for each column.