Cannot find either column "dbo" or the user-defined function or aggreg

Hi All,
I have got a problem here but cannot solve it. i am trying to call a UDF but it gives me the following error
[b][color=Red]Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fncs_split", or the name is ambiguous[/color].[/b]

i call using simple statement like
[code]select dbo.fncs_split('564465,545445,656545', ',') as t [/code]

and here is the code for the UDF
[code]
CREATE FUNCTION dbo.fncs_split (
@str_in NVARCHAR(500),
@separator VARCHAR(4)
)
RETURNS @strtable TABLE (strval NVARCHAR(500))

AS

BEGIN

DECLARE @tmpStr NVARCHAR(500), @charind INT, @SeperatorLength INT

SELECT @tmpStr = @str_in, @SeperatorLength = LEN(REPLACE(@separator, SPACE(1), 'X'))

WHILE LEN(@tmpStr) > 0
BEGIN

SET @charind = CHARINDEX(@separator, @tmpStr)

IF @charind > 0
BEGIN
IF @charind > 1
INSERT INTO @strtable SELECT SUBSTRING( @tmpStr, 1, CHARINDEX(@separator,@tmpStr)-1 )

SELECT @tmpStr = SUBSTRING(@tmpStr, @charind + @SeperatorLength, LEN(REPLACE(@tmpStr, SPACE(1), 'X')) - (@charind + @SeperatorLength - 1) )
END
ELSE
BEGIN
INSERT INTO @strtable SELECT @tmpStr
SELECT @tmpStr = ''
END

END

RETURN

END

GO
GRANT SELECT ON [dbo].[fncs_split] TO public

Go

[/code]

Please suggest someting regarding this error

Comments

  • hi friend

    try this

    select * from dbo.fncs_split('564465,545445,656545', ',')

    it will work

    thanks,
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion