I don't get any errors running your script. The function is created successfully and works properly. I'm connecting to SQL 2000 SP3.
>I'm trying to create a simple function
>
>CREATE FUNCTION Add2Numbers (@X INT, @Y INT)
>RETURNS INT
>AS
>BEGIN
> DECLARE @Z INT
> SET @Z = @X + @Y
> RETURN(@Z)
>END
>
>
>Getting error:
>"Error 170: Line1: Incorrect syntax near 'FUNCTION'.
>Must declare the variable '@X'.
>A RETURN statement with a return value cannot be used in this context."
--sb--