这是我函数中的代码:
-- Get Country Names
DECLARE getCountriesName CURSOR FOR
SELECT c.Name
FROM VocabCountry c
RIGHT OUTER JOIN ProjectCountryRelations cr
ON cr.CountryId = c.Id
WHERE
c.Id = @project_id;
-- Finally Create list to return
OPEN getCountriesName;
FETCH NEXT FROM getCountriesName INTO @Name;
WHILE @@FETCH_STATUS = 0
BEGIN
SET @listOfItems = @listOfItems + @Name + ', '
FETCH NEXT FROM getCountriesName INTO @Name;
END;
CLOSE getCountriesName;
DEALLOCATE getCountriesName;
我期待一个逗号分隔值的列表,例如,像这样:
Canada, United States of America,
我验证SELECT
了国家预期的回报。
谢谢你的帮助!
埃里克