Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 values in integer horizontally

Author  Topic 

akas
Starting Member

42 Posts

Posted - 2009-03-03 : 09:20:59
Thanks for replyin Peso..but still getting same results..

i have one function:
CREATE FUNCTION [dbo].[UDFNumberList]
(
@FK varchar(200)
)
RETURNS varchar(5000)
AS
BEGIN
DECLARE @Number varchar(8000)

SELECT @Number= COALESCE(@Number+',','') + convert(varchar(200),m.media_id)
FROM dbo.media m
inner join contact_media cm
on cm.media_id = m.media_id
inner join contact c
on c.contact_id = cm.contact_id
WHERE c.contact_id=@FK
RETURN @Number
END

in media_id the values are 9,15,28,26,7,1,0 - integer values..

but i am getting wrong results...can anyone help me.

thanks

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-03-03 : 09:29:07
I suggest you format your post. This will give anyone a headache.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-03 : 09:29:41
One JOIN less
CREATE FUNCTION [dbo].[UDFNumberListnumber1]
(
@FK varchar(200)
)
RETURNS VARCHAR(5000)
AS
BEGIN
DECLARE @Number varchar(8000)

SELECT @Number = COALESCE(@Number + ',', '') + convert(varchar(200), cm.media_id)
FROM contact_media AS cm
inner join contact c on c.contact_id = cm.contact_id
WHERE c.contact_id = @FK

RETURN @Number
END



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

akas
Starting Member

42 Posts

Posted - 2009-03-03 : 09:50:17
ok got it!!

thanks!!
Go to Top of Page
   

- Advertisement -