Declare myCurrsor Cursor Local For
select isnull(First_Name,'') + ' ' + isnull(Last_Name,'') as InvestigatorName from dbo.Investigator where Study_ID = @StudyId
open myCurrsor
Fetch Next from myCurrsor into @InvestigatorName
While @@Fetch_Status = 0
begin
if(@count > 0)
begin
select @ResultVar = @ResultVar + ', '
end
select @ResultVar = @ResultVar + @InvestigatorName
Fetch Next from myCurrsor into @InvestigatorName
end
select isnull(First_Name,'') + ' ' + isnull(Last_Name,'') as InvestigatorName from dbo.Investigator where Study_ID = @StudyId
open myCurrsor
Fetch Next from myCurrsor into @InvestigatorName
While @@Fetch_Status = 0
begin
if(@count > 0)
begin
select @ResultVar = @ResultVar + ', '
end
select @ResultVar = @ResultVar + @InvestigatorName
Fetch Next from myCurrsor into @InvestigatorName
end