Posted by: Echoes February 24, 2008
Login in to Rate this Post:
0
?
create function [dbo].fn_inonerow(@p_empid int)
returns nvarchar(4000)
as
begin
declare @orderids nvarchar(4000)
select @orderids = coalesce(@orderids + ', ', '') + rtrim(orderid)
from orders a
inner join employees b
on b.employeeid=a.employeeid
where b.employeeid=@p_empid
return @orderids
end
go
--Then call the function like this:
select [dbo].fn_inonerow(1) as orderids