I have a table containing users. Each user contains a smalldatetime field called Created.
In my stored Procedure (spGetUsers) I have 2 input parameters: @Day, @LastDayOfMonth. The @Day parameter can be integers from 1 to 31, the @LastDayOfMonth is '0' or '1'.
I need to return all users based on what day number the Created fields is.
Example: I want to return all users where Created day is 10th. and Status='1'. I don't care about the month or year.
There is also another issue. If the Parameter called @LastDayOfMonth (bit) is "1" the procedure shall return all users where Created day >= @Day AND Status = '1'.
Thanks for all tips :)