• You should use an IF...ELSE... statement if you want to evaluate a condition.

    With your query you're assigning the value to the variable, not comparing. It should be like this.

    IF @CurrentDay = DAY(CURRENT_TIMESTAMP)

    PRINT 'Today is the 24th day of the month'

    After that, you should use the ELSE and generate an error. I will leave this to investigate and come back and ask for specific questions.

    Here's a guide:

    http://msdn.microsoft.com/en-us/library/ms178592.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2