I am new to SQL and trying to create a function in MS SQL 2008R2, but I can not declare a variable inside the function. What is wrong with this code?
CREATE FUNCTION denominator() RETURNS int BEGIN DECLARE @Count;
I get errors like this:
Msg 102, Level 15, State 1, Procedure denominator, Line 3 Incorrect syntax near ';'. Msg 4121, Level 16, State 1, Line 1 Cannot find either column "dbo" or the user-defined function or aggregate "dbo.denominator", or the name is ambiguous.
vmeln source share