Can we Made below function without using Cursor??Please help
ALTER FUNCTION [CRM].[SUNDRY_JOB_WORK] (@RequestId BIGINT)
RETURNS varchar(1000)
AS
BEGIN
declare @JobWork Varchar(200)
declare @JobWorks Varchar(1000)
set @JobWorks='';
DECLARE curAllTables CURSOR FOR
select aa.DESCRIPTION from TECH_REQUEST_JOB_TYPE_DETAIL TT inner join MST_JOB_WORK_TYPES aa ON TT.JOB_WORK_ID=aa.JOB_WORK_TYPE_ID
WHERE REQUEST_ID=@RequestId
OPEN curAllTables
FETCH NEXT FROM curAllTables INTO @JobWork
WHILE (@@FETCH_STATUS=0)
BEGIN
set @JobWorks = @JobWorks+@JobWork+','
FETCH NEXT FROM curAllTables INTO @JobWork
END
set @JobWorks=substring(@JobWorks,1,LEN(@JobWorks)-1)
CLOSE curAllTables
deallocate curAllTables
RETURN @JobWorks
END