How to use user-defined function without errors

  • If i have user-defined function with two parameters of SmallDateTime and i want to raise error if the first date is bigger than the second, what to do? I want to use a function for an update statement, for example.

  • This was removed by the editor as SPAM

  • Use the RAISERROR function like this:

     
    
    if FirstDate > SecondDate
    RAISERROR ('The SecondDate must be bigger than de FirstDate',16,1)
  • Invalid use of 'RAISEERROR' within a function. I could not use RAISEERROR and a lot of other things inside a function.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply