Determine 3rd Friday of each month I need to determine the dates which are the "3rd Friday of each month" for a date range of "1.1.1996 - 30.8.2014" in SQL Server.

I expect I should use a combination of DENSE_RANK() and PARTITION BY() to set "rank = 3". However, I am new to SQL and unable to find the correct code.
Given:


Friday is called "Friday" 
The 3rd Friday of the month will always
fall from 15th-21st of the month

select thedate
from yourtable
where datename(weekday, thedate) = 'Friday'
and datepart(day, thedate)&gt;=15 and datepart(day, thedate)&lt;=21;



You could also use weekday with datepart(), but it's more readable with a name IMO. String comparisons will obviously be slower though.