My SQL scalar valued function is defined in the following code:
CREATE FUNCTION CtrAmount ( @Ctr_Id int ) RETURNS MONEY AS BEGIN DECLARE @CtrPrice MONEY SELECT @CtrPrice = SUM(amount) FROM Contracts WHERE contract_id = @Ctr_Id RETURN(@CtrPrice) END GO SELECT * FROM CtrAmount(345) GO But when it comes to the SELECT line, I am getting this error:
Msg 208, Level 16, State 3, Line 14 Invalid object name 'CtrAmount'.
SELECT CtrAmount(345)- check about scalar and table user functions