Please someone can help me. I need a function which just returns the number of rows from known table. I tried it like:
CREATE FUNCTION getRows ( @id int ) RETURNS int AS BEGIN DECLARE @rownums int SELECT Count(*) FROM dbo.MainData where id=@id RETURN @rownums END
But it throws me
Msg 444, Level 16, State 2, Procedure getRows, Line 9
Select statements included within a function cannot return data to a client.
what's wrong with my select?