Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string concatenation 1

Status
Not open for further replies.

yan19454

MIS
May 19, 2005
94
US
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.
 
OK, can you give examples of where the function is not working?

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top