August 21, 2002 at 12:02 pm
I am trying to access function like this.
select dbo.collaborator('1,2,3')
but I getting following error.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.collaborator'.
My other functions are working fine but I don't understand why this particular function is not working.
here is my function.
CREATE function collaborator (@str varchar(8000))
returns @collaborator table (
names varchar(40)
)
as
BEGIN
DECLARE @len int, @CurPos int, @PrevPos int
SET @len = LEN(@str) + 1
SET @CurPos = 1
SET @PrevPos = @CurPos
WHILE @CurPos < @len + 1
BEGIN
IF SUBSTRING(@str + ',', @CurPos, 1) = ','
BEGIN
INSERT INTO @collaborator (names)
SELECT SUBSTRING(@str,@PrevPos,@CurPos - @PrevPos)
SET @PrevPos = @CurPos + 1
END
SET @CurPos = @CurPos + 1
END
RETURN
END -- fn def
appreciated if someone could help me.
Thanks
August 21, 2002 at 12:18 pm
Sorry, I got the answer.
Actually, I should use the function like this.
Select * from dbo.collaborator('1,2,3')
Because the return values are in table.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply