table IssuedBooks
{
column RollNo,BookNo,BookName,AuthorName,IssueDate,Fine
}
I want to create a function which fills or gives the calculated Fine when called.
Suppose after 15 days of IssueDate there is a fine of 5 each day. May be I can send the IssueDate as parameter to the function and then calculate the difference between the IssueDate and Current date using DATEDIFF(DAY,IssueDate,CAST(GETDATE() as date)) and then use the number of days returned to check whether they are greater than 15 and calculate the fine accordingly and return it through function.
I am very confused about how to implement it, what will be the queries etc. Please help.
Thank you very much in advance..