title: Iterating through a list of strings in a function
body: <p>I have declare a temporary table @OrgTable and I'm populating it with a single column of strings which represent organisation codes.
  Prior to populating @OrgTable the codes are part of a continuous string which are delimited by a '|'.
  I have written a function SplitString to do just that and the individual codes are then inserted into the table.
  Finally I'm calling a second function, NBOCAP, into which I pass a start date, and end date and each organisation code from @OrgTable so I need to modify my script so it iterates through each organisation code. What form should my script take please? It needs to be backwards compatible with SQL2000.</p>
  
  <pre><code>DECLARE @OrgTable TABLE
  (
      elem varchar(1000)
  )
  
  INSERT INTO @OrgTable
  SELECT * FROM SplitString(@OrgCodeString, '|')
  
  SELECT * FROM NBOCAP(@StartDate,@EndDate,organisation code)
  </code></pre>