Here is the thing:
I have a table
DailyContent (dailyContentId, userId, weekDayId, eventId)
 in which I store items for certain days (for each user).
Days are divided in different events (more events per day).
What I would like to do is select items (for ONE event) but for various number of days.
Days have ID from 1 to 7. If day is "selected" I get dayId, otherwise I get null as input parameter.

IF more then one day is selected, then only items, which are in common for all days are returned.

If no day(s) is/are selected then nothing is returned

I have tried something like this, but I get only results for one day.
If I select more then one day then NOTHING is returned (items which are stored for both days for this event should be returned, as I described above).

```
DECLARE @daysCount int -- only for incitation how many days are actually set
SET @daysCount = 0
IF (@mon IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@tue IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@wed IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@thu IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@fri IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@sat IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END
IF (@sun IS NOT NULL)
    BEGIN
        SET @daysCount = @daysCount+1
    END

-- Insert statements for procedure here
SELECT 
    DailyContent.dailyContentId

            FROM DailyContent

    WHERE
    eventId=@eventId AND (weekDayId=@mon OR
            weekDayId=@tue OR
            weekDayId=@wed  OR
            weekDayId=@thu  OR
            weekDayId=@fri  OR
            weekDayId=@sat  OR
            weekDayId=@sun)
    GROUP BY DailyContent.dailyContentId
    HAVING (COUNT(dailyContentId) = @daysCount)

```

Something is wrong with this HAVING COUNT.
If I remove it it works OK, but only if one day is selected.

Actually I would like the opposite of "select all if parameters are null".

I am using MS SQL server 2008.

Any help would be greatly appreciated.