i ve to display data in commas in sql :-
Returning a Comma

CREATE FUNCTION dbo.fn_GetTherapistName(@AppCode int)
RETURNS VARCHAR(1000) AS

BEGIN
   DECLARE @StudentList varchar(1000)

   --SELECT @StudentList = COALESCE(@StudentList + ', ', '') + CAST(m.TherapistId AS VARCHAR(15))
   --FROM multipleTherapy m
   --WHERE m.AppCode = @AppCode
SELECT @StudentList = COALESCE(@StudentList + ', ', '') + CAST(dbo.staff_Master.firstname AS VARCHAR(100))
FROM         dbo.multipleTherapy INNER JOIN
                      dbo.staff_Master ON dbo.multipleTherapy.TherapistId = dbo.staff_Master.empcode
WHERE     (dbo.multipleTherapy.AppCode = @AppCode)

   RETURN @StudentList
END

Comments

Popular posts from this blog