Wednesday, March 7, 2012

Bug Creating UDF in MSSQL2000

Whe i try to create the next udf:
CREATE FUNCTION CubicVolume
-- Input dimensions in centimeters
(@.CubeLength decimal(4,1), @.CubeWidth decimal(4,1),
@.CubeHeight decimal(4,1) )
RETURNS decimal(12,3) -- Cubic Centimeters.
AS
BEGIN
RETURN ( @.CubeLength * @.CubeWidth * @.CubeHeight )
END
I get the next error:
Error 170: Line 1: Incorrect syntax near 'FUNCTION'.
Must declare the variable '@.vCubeLength'.
Please Helpme, thanks.This executed perfectly from Query Analyzer in tempdb on My SQL Server 2000 sp3. Are you certain you
don't have other stuff in your script file which was included in the execution?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"jpastorf" <jpastorf@.costarricense.cr> wrote in message
news:010d01c4a0be$5cdb1ab0$a301280a@.phx.gbl...
> Whe i try to create the next udf:
> CREATE FUNCTION CubicVolume
> -- Input dimensions in centimeters
> (@.CubeLength decimal(4,1), @.CubeWidth decimal(4,1),
> @.CubeHeight decimal(4,1) )
> RETURNS decimal(12,3) -- Cubic Centimeters.
> AS
> BEGIN
> RETURN ( @.CubeLength * @.CubeWidth * @.CubeHeight )
> END
> I get the next error:
> Error 170: Line 1: Incorrect syntax near 'FUNCTION'.
> Must declare the variable '@.vCubeLength'.
> Please Helpme, thanks.|||My top guesse:
This is a SQL Server version prior to the 2000 version, or this is SQL
Servr 2000, but you have set the compatibility mode to below 80 for this
database.
Steve Kass
Drew University
jpastorf wrote:
>Whe i try to create the next udf:
>CREATE FUNCTION CubicVolume
>-- Input dimensions in centimeters
> (@.CubeLength decimal(4,1), @.CubeWidth decimal(4,1),
> @.CubeHeight decimal(4,1) )
>RETURNS decimal(12,3) -- Cubic Centimeters.
>AS
>BEGIN
> RETURN ( @.CubeLength * @.CubeWidth * @.CubeHeight )
>END
>I get the next error:
>Error 170: Line 1: Incorrect syntax near 'FUNCTION'.
>Must declare the variable '@.vCubeLength'.
>Please Helpme, thanks.
>

No comments:

Post a Comment