Re: Comma-delimited Output
The attachments don't explain everything, (what is the [dbo].[findstandbyidno] table?)
Anyway, why is (WHERE [rent] = @rentID) commented?
Re: Comma-delimited Output
Alter your function dbo.[ufn_Getdescription] as below
Code:
CREATE FUNCTION [dbo].[ufn_Getdescription] ( @rentID INT )
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @Descriptions VARCHAR(8000)
Declare @Desc Valrchar(50)
Declare TmpCur For select [Description] From findstandbyidno where rent = @rentID
Open TmpCur
Fetch Next from TmpCur Into @Desc
Begin
if @desc is not null
set @Descriptions=@Descriptions + Case when @Descriptions='' then '' else ',' end + @Desc
Fetch Next from TmpCur Into @Desc
End
close tmpcur
Deallocate tmpcur
RETURN @Descriptions
END