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 2005 Forums
 Transact-SQL (2005)
 user defined function(error)

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2010-02-13 : 11:04:15
Hi
i have created a user defined function

CREATE FUNCTION SalesByStore (@fldgaugekey bigint)
RETURNS TABLE AS
RETURN (SELECT fldgoupper, fldcerfno
FROM stdguagedetail
WHERE fldguagekey = @fldguagekey)

but it shows error message
Msg 137, Level 15, State 2, Procedure SalesByStore, Line 5
Must declare the scalar variable "@fldguagekey".


Desikankannan

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-13 : 11:08:15
quote:
Originally posted by desikankannan

Hi
i have created a user defined function

CREATE FUNCTION SalesByStore (@fldgaugekey bigint)
RETURNS TABLE AS
RETURN (SELECT fldgoupper, fldcerfno
FROM stdguagedetail
WHERE fldguagekey = @fldguagekey)

but it shows error message
Msg 137, Level 15, State 2, Procedure SalesByStore, Line 5
Must declare the scalar variable "@fldguagekey".


Desikankannan


its a simple typo
you've @fldgaugekey in definition and inside body you've it as @fldguagekey. it should be @fldgauagekey


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

desikankannan
Posting Yak Master

152 Posts

Posted - 2010-02-13 : 11:15:02
yes its work thanks a lot

Desikankannan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-13 : 11:26:53
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -