>>>I have a table with a field that contains one or more strings separtated by commas. I need a SPT that can count the number of strings. The table is a db2 file.
>>
>>Maybe I'm missing something but wouldn't this work:
>>
>>
>>Select PK, iif(empty(myfield),0,occurs(',',myfield)+1) as stringcnt from mytable group by 1 into cursor mycursor
>>calculate sum(stringcnt) to totalcnt
>>
>>
>>to get the number of strings in each record and a total count for the file. Of course, if all you need is a total count for the file:
>>
>>
>>Select SUM(iif(empty(myfield),0,occurs(',',myfield)+1)) as stringcnt from mytable into cursor mycursor
>>
>
>Except for the fact that there is no native OCCURS function in SQL Server and I'm not sure about DB2.
That would be what I was missing... TSQL vs Fox syntax.
John White [MOST]