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)
 Error 2739 when trying to create a user-defiened function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-18 : 09:27:10
SJ writes "Hi guys:
When I tried to create a user-defiened function I got this error
Error 2739:Cannot use empty object or column names. Use a single space if necessary.

the purpose of this function is:
it takes arabic string with arabic script and remove the arabic script , then return a free script string ..
the function is :
================================================
CREATE FUNCTION fn_RemoveTashkeel (@InputString ntext)
RETURNS ntext
AS
BEGIN
DECLARE @OutputString ntext COLLATE Arabic_BIN
DECLARE @TashkeelChr char(8) COLLATE Arabic_BIN
DECLARE @feed int
SET @OutputString=@InputString
-- @TashkeelChr holds arabic script string
SET @TashkeelChr="Arabic Script List"
SET @feed=1
WHILE @feed<=LEN(@TashkeelChr)
BEGIN
SET @OutputString=REPLACE(@OutputString,SUBSTRING(@TashkeelChr,@feed,1),"")
SET @feed=@feed+1
END
RETURN(@OutputString)
END"

Nazim
A custom title

1408 Posts

Posted - 2002-02-18 : 10:05:14
the Error is because of

SET @OutputString=REPLACE(@OutputString,SUBSTRING(@TashkeelChr,@feed,1),"") -- replace it with single quotes


Avoid using double quotes in your code

CREATE FUNCTION fn_RemoveTashkeel (@InputString ntext)
RETURNS ntext
AS
BEGIN
DECLARE @OutputString ntext COLLATE Arabic_BIN
DECLARE @TashkeelChr char(8) COLLATE Arabic_BIN
DECLARE @feed int
SET @OutputString=@InputString
-- @TashkeelChr holds arabic script string
SET @TashkeelChr="Arabic Script List"
SET @feed=1
WHILE @feed<=LEN(@TashkeelChr)
BEGIN
SET @OutputString=REPLACE(@OutputString,SUBSTRING(@TashkeelChr,@feed,1),'')
SET @feed=@feed+1
END
RETURN(@OutputString)
END"

--------------------------------------------------------------
"Happiness is not something you experience, it's something you remember."
Go to Top of Page
   

- Advertisement -