Function Details:
alter FUNCTION siralama_puan (@suggestion_id int)
RETURNS int
AS
Begin
Declare @comment_count int,@like_count int,@favorite_count int,@date_point int,@suggestion_point int,@suggestion_date datetime,@fark int
set @comment_count=(select [Suggestion].CommentCount from [Suggestion] where [Suggestion].Id= @suggestion_id)
set @like_count=(select [Suggestion].LikeCount from [Suggestion] where [Suggestion].Id=@suggestion_id)
set @favorite_count=(select [Suggestion].FavoriteCount from [Suggestion] where [Suggestion].Id=@suggestion_id)
set @suggestion_date=(select [Suggestion].Crtm from [Suggestion] where [Suggestion].Id=@suggestion_id)
set @fark =(select DATEDIFF(day,@suggestion_date,GETDATE()))
if @fark<6
set @date_point=30
else if @fark<10 and @fark>=6
set @date_point=20
else
set @date_point=10
set @suggestion_point=(@comment_count*2)+(@like_count)+(@favorite_count*3)+@date_point
RETURN @suggestion_point
End
Calling Function:
select dbo.siralama_puan (122280,1) as puan order by puan desc
but it didn't work.Error:Procedure or function dbo.siralama_puan has too many arguments specified.Multiple arguments not working.