views:

41

answers:

0

I have the following code that I use in a Query to update a table called ListClientCasePresentingIncidents which uses a function called fnSplit to split a comma seperated nvarchar named @CasePresentingIncidents.

   IF ( @CasePresentingIncidents <> '' ) 
    INSERT  INTO ListClientCasePresentingIncidents
            ( PresentingIncident ,
              CaseID
            )
            SELECT  SplitText AS PresentingIncident ,
                    @CaseID
            FROM    fnSplit(@CasePresentingIncidents)

All of this works really well one record at a time, passing in a value for @CaseID and @CasePresentingIncidents.

The question is, how would I modify this code so that it took values from a table called ClientCase rather than 2 parameters? It would need to replace @CaseID and @CasePresentingIncidents with the values from ClientCase.CaseID and ClientCase.CasePresentingIncidents. Many thanks.