This Codes give me error:
Msg 156, Level 15, State 1, Procedure DefaultActivity, Line 2
Incorrect syntax near the keyword 'RETURN'.
Msg 137, Level 15, State 2, Procedure DefaultActivity, Line 3
Must declare the scalar variable "@returnTable".
Msg 1087, Level 15, State 2, Procedure DefaultActivity, Line 18
Must declare the table variable "@returnTable".
CREATE FUNCTION dbo.DefaultActivity
RETURNS
@returnTable table (
[VisitingCount] int,
[Time] nvarchar(50)
)
AS
BEGIN
DECLARE @DateNow DATETIME,@i int
set @DateNow='00:00'
set @i=1;
while(@i<1440)
begin
set @DateNow=DATEADD(minute, 1, @DateNow)
insert into @returnTable ([VisitingCount], [Time]) values(0, right(left(convert(nvarchar, @DateNow, 121), 16), 5))
set @i=@i+1
end
RETURN
END