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
 Transact-SQL (2000)
 Create function error- database comp level 65

Author  Topic 

cindylee
Yak Posting Veteran

55 Posts

Posted - 2006-02-23 : 19:57:36
Hi guys
i tried to create the followin function on one of our database(compt level 65). getting the error :

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'FUNCTION'.

but its workin fine on test database(compt level 80) .Anyone know the script db level 65 Thanks



CREATE FUNCTION dbo.test(@client int)

RETURNS VARCHAR(5000)
AS
BEGIN
DECLARE @Output VARCHAR(5000)
SELECT @Output = COALESCE(@Output+'; ', '') + CONVERT(varchar(250), [title]) + '-'+ CONVERT(varchar(75), [call]) + '-$' + Convert(Varchar(25),price/100)
FROM testtable
where [id] = @client

RETURN @Output
END


Thanks






tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-02-23 : 20:01:30
Compatibility level of 65 means you are using SQL Server 6.5 features. User-defined functions are not available until SQL Server 2000, which is compatibility level 80. So you can't create functions in 65 compatibility level.

Tara Kizer
aka tduggan
Go to Top of Page

cindylee
Yak Posting Veteran

55 Posts

Posted - 2006-02-23 : 20:08:44
ohhh k..guess i have to use procedure then. Thanks Tara

Cindy
Go to Top of Page
   

- Advertisement -