hmm i think this is from a register right?
if yea check as the error say the funcion dbo.clearonlinerecords does not exist
thats why it give u this error u cant run a function on sql javascrip asp or any programming language that you didnt def it just check again the code and be sure u add the function