And here is one without cursors:
CREATE FUNCTION fGetSTR_DATAList (@XX INT, @YY INT)
RETURNS VARCHAR(1000) AS
BEGIN
DECLARE @STR_DATAList VARCHAR(1000)
SELECT @STR_DATAList = ISNULL(@STR_DATAList + ', ', '') + TableC.STR_DATA
FROM
WHERE TableC.XX=@XX AND TableC.YY=@YY
RETURN...