according to this :
I created my function.
create FUNCTION dbo.combine_cptcode
(@pid As char(8))
RETURNS varchar(1000)
AS
BEGIN
DECLARE @cptcode AS varchar(1000)
SET @cptcode = ''
SELECT @cptcode = case @cptcode when '' then BILLINGHC
else
@cptcode + ','+ BILLINGHC
END
from CPTCodeop where PatientID=@pid order by BILLINGHC
RETURN @cptcode
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Thx. it has results , but the results are not my expected. but the BILLINGHC is not rowset string concatenation . I looked at my function is nothing different from the example.
select distinct PatientID, dbo.combine_cptcode(PatientID) from CPTCodeop group by PatientID
Thx.
I created my function.
create FUNCTION dbo.combine_cptcode
(@pid As char(8))
RETURNS varchar(1000)
AS
BEGIN
DECLARE @cptcode AS varchar(1000)
SET @cptcode = ''
SELECT @cptcode = case @cptcode when '' then BILLINGHC
else
@cptcode + ','+ BILLINGHC
END
from CPTCodeop where PatientID=@pid order by BILLINGHC
RETURN @cptcode
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Thx. it has results , but the results are not my expected. but the BILLINGHC is not rowset string concatenation . I looked at my function is nothing different from the example.
select distinct PatientID, dbo.combine_cptcode(PatientID) from CPTCodeop group by PatientID
Thx.