Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   user defien function throws an error (http://www.go4expert.com/forums/user-defien-function-throws-error-t6795/)

ERUM 12Oct2007 12:31

user defien function throws an error
 
CREATE FUNCTION dbo.myFunction1()
AS
BEGIN
DECLARE @myInt INT
SET @myInt = 1
-- Function body goes here
--RETURN @myInt
END

i write above udf which neither accepts nor return any value but it says

Incorrect syntax near the keyword 'AS'.

what is mistake i have made

venkatesanj@hcl.in 31Oct2007 17:08

Re: user defien function throws an error
 
Just make a try with the below code sir,

you should not use 'AS' keyword like Stored procedure


CREATE FUNCTION dbo.myFunction1()
returns int
BEGIN
DECLARE @myInt INT
SET @myInt = 1
-- Function body goes here
RETURN @myInt
END

Regards,
Venkatesan Prabu. J


All times are GMT +5.5. The time now is 08:40.